Added generic method for paging