final Cursor startCursor = getStartCursor(currentPageNum, pageSize, preparedQuery);
queryResultList = preparedQuery.asQueryResultList(withStartCursor(
startCursor).limit(pageSize).chunkSize(QUERY_CHUNK_SIZE));
} else { // The first page
queryResultList = preparedQuery.asQueryResultList(withLimit(pageSize).chunkSize(QUERY_CHUNK_SIZE));
}
// Converts entities to json objects
final JSONArray results = new JSONArray();
ret.put(Keys.RESULTS, results);