move pagination to controller.