Wrote backend implementation for pagination the query results of query methods