public async Task <IEnumerable <Models.Location> > GetLocationsAsync(IEnumerable <string> zipCodes) { var validatedZipCodes = _ValidateZipCodes(zipCodes); try { var locations = await Task.WhenAll(validatedZipCodes.Select(zipCode => _apiClient.ExecuteAsync(new GetPlacesByZipCodeRequest(zipCode)))); return(from location in locations from places in location.Places group new { places, location.PostCode } by places.State into resultsByState select new Models.Location { State = resultsByState.Key, Places = resultsByState.Select(g => new Place(g.places, g.PostCode)).ToList() }); } catch (WebException ex) { _HandleWebException(ex); throw; } }