private async Task <List <SearchViewModel> > SearchShows(string query, MyList myList) { // build the API request string, and get it var response = await webRequest.Get(showService.ConvertToShowSearch(query)); if (!response.IsSuccessStatusCode) { throw new ArgumentException("Query request failed"); } // actually download the content var content = await response.Content.ReadAsStringAsync(); // convert httpResponse into JSON var json = JObject.Parse(content); // get all the results as a list IList <JToken> results = json["results"].Children().ToList(); List <SearchViewModel> showList = new List <SearchViewModel>(); foreach (JToken r in results) { Show showResult = r.ToObject <Show>(); try { showResult.Started = DateTime.ParseExact(r["first_aired"].ToString(), "yyyy-M-d", null).ToString("y"); } catch (FormatException) { showResult.Started = "Unknown Start Date"; } showResult.Artwork = r["artwork_304x171"].ToString(); bool inList = false; if (myList != null) { var listCheck = myList.MyListShows? .FirstOrDefault(x => x.ShowId == showResult.ID); inList = listCheck == null ? false : true; } showList.Add(new SearchViewModel() { IsInList = inList, Show = showResult }); } return(showList); }