public async Task HandleAsync(UpdateBasket command, ICorrelationContext context) { CustomerBasket basket = await _basketRepo.GetAsync(command.BasketId); if (basket is null) { throw new MedParkException("basket_does_not_exist", $"The basket {command.BasketId} does not exist."); } command.Items.ToList().ForEach(async(item) => { BasketItem bItem = await _basketItemRepo.GetAsync(x => x.BasketId == basket.Id && x.ProductId == item.ProductId); bItem.UpdateQuantity(item.Quantity); bItem.UpdatedModifiedDate(); await _basketItemRepo.UpdateAsync(bItem); }); }