implemented pagination and sorting for loans api

MIFOSX-339 is also addressed for loans api