private void DoUpdateVenues(string key, DateTime since) { var count = Channel.get_venue_count(key, since); var offset = 0; if (count > 0) { _cacheVenues = null; } while (offset < count) { // get the next batch var a = Channel.get_venues(key, since, offset); offset += a.Length; foreach (var x in a) { var id = TicketJonesVenue.For(x.id); var venue = Venues.TryGet(id) ?? new TicketJonesVenue { Document = new Document { Id = id }, }; venue.TicketJonesId = x.id.ToString(); venue.Address = new Address { Address1 = x.address1, Address2 = x.address2, City = x.city, State = x.province, Country = x.country, }; venue.Phone = new Phone { Number = x.phone }; venue.Name = x.name; Venues.Save(venue); } } }