Pagination helpers for Query and Scan - to be tested