Move paginated DNS query code to iterate_records.