Refactor the PaginationHelper a little bit.