Refactor a method on PaginateIt mixin
Refactor code to reduce the lines of code required on controller