}//method private void ImportBooksInCategory(BookCategory category, string keyword, int count) { var skip = 0; var currentCount = 0; while (currentCount < count) { var volumeSet = _client.GetVolumes(keyword, skip); skip += volumeSet.Items.Count; foreach (var volume in volumeSet.Items) { var vinfo = volume.VolumeInfo; if (string.IsNullOrWhiteSpace(vinfo.Publisher)) //some books don't have publisher, just skip these { continue; } var title = Trim(vinfo.Title, 120); if (_bookCache.ContainsKey(title)) { continue; } currentCount++; var ipub = GetCreatePublisher(vinfo.Publisher); var pubDate = ParsePublishedDate(vinfo.PublishedDate); var image = LoadImageFromUrl(vinfo.ImageLinks.Thumbnail); var price = GetPrice(volume.SaleInfo); var ibook = _session.NewBook(BookEdition.Paperback, category, title, vinfo.SubTitle, ipub, pubDate, price, coverImage: image); ibook.Abstract = vinfo.Description; _bookCache.Add(vinfo.Title, ibook); //parse authors if (vinfo.Authors != null) { foreach (var author in vinfo.Authors) { var iauth = GetCreateAuthor(author); if (iauth != null) { ibook.Authors.Add(iauth); } } } }//foreach volume } try { _session.SaveChanges(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Exception: " + ex.ToLogString()); throw; } }