Added grape paginated api
Refactoring code