public async Task <IEnumerable <Tuple <ItemCart, Price> > > GetItemsInCartPricesByStoreAsync(long chainId, int storeId, IEnumerable <ItemCart> items) { using (var context = new PriceCompareDbContext()) { var priceRep = new PriceRepository(context); var allPricesInStore = await priceRep.GetPricesByStoreIdAsync(storeId, chainId); var pricesInStore = allPricesInStore.ToArray(); if (pricesInStore.Count() != 0) { return(await Task.Run(() => items.ToList() .Select(item => new Tuple <ItemCart, Price>(item, pricesInStore .FirstOrDefault(price => price.ItemCode == item.ItemCode))))); } return(null); } }