In the Peter Jackson The Hobbit movies, we see that Legolas was one of the elves that personally captured the dwarves in Mirkwood forest, pursued them down the river, fought some Orcs in Lake Town, and fought in the Battle of Five armies (defying physics along the way).
In the book version of The Hobbit, what was Legolas doing? Was this explained in any of the appendices or something?
I don't think that this is a duplicate of Is Legolas in The Hobbit Book? because that asks about it from an out-of-universe perspective and I am wondering about it from an in-universe perspective.