There is an assumption here that the search results are sorted by id - this may not always be true?? It's probably better to use the "next_results" query string in the "search_metadata" than to rely on sorted results.