move pagination to controller