private IEnumerable<ReadingList> DoPopulateReadingLists(IEnumerable<string> readingLists) { var readingListCollection = new Collection<ReadingList>(); foreach (var item in readingLists) { var uri = string.Format("{0}.json", item); var readingListNavObj = FetchItemsInternal(uri); if (readingListNavObj == null) { Log.Error("Reading list from uri:{0} could not be scraped.", uri); continue; } readingListCollection.Add(new ReadingList { Uri = uri, ListInfo = readingListNavObj }); } if (readingListCollection.HasContent()) {//fetch books from discovered lists and add them to the relevant list foreach (var rlItem in readingListCollection) { if (_scrapeCancelled) return null; foreach (var rlItemList in rlItem.ListInfo.Items.Contains) { if (_scrapeCancelled) return null; if (rlItemList.Value.Contains("/items/")) { var getbookItems = FetchItemsInternal(rlItem.Uri); if (getbookItems != null && getbookItems.Items.Contains.HasContent()) {//scrape individual book info foreach (var book in getbookItems.Items.Contains) { if (_scrapeCancelled) return null; if (book.Value.Contains("/items/")) { var bookItem = FetchJson(string.Format("{0}.json", book.Value)); if (!string.IsNullOrEmpty(bookItem)) { var bookObj = ParseBookInfoFromJson(book.Value, bookItem); if (bookObj != null) rlItem.Books.Add(bookObj); } } } } } } } } return readingListCollection; }