Add functions to abstract behavior around grouping/filtering/sorting/truncating when building a book

It doesn't change anything at the moment but it should make things easier later on.