Backend sorting and paging functionality