added order and pagination to getRecords