Implement pagination from model/controller side