public void UpdateBasket(Basket basket, KaskoModificationBasketModel update)
{
if (!basket.EntityContext.ContainsKey(nameof(KaskoModificationBasketModel)))
{
basket.EntityContext.Add(nameof(KaskoModificationBasketModel), update);
}


        var deal = basket.GetKaskoDeal();
        if (deal != null)
        {
            if (update.Deal == null)
            {
                return;
            }

            var updateDeal = update.Deal;
            var updateOwner = updateDeal.Owner?.Person;
            var updateInsurant = updateDeal.Insurant?.Person;
            var updateAuto = updateDeal.Auto;
            var updateTsIdentityCard = updateDeal.Auto?.TsIdentityCard;
            var updateDrivers = updateDeal.Drivers;

            deal.AutoDeal.IsMultidrive = updateDeal.IsMultidrive ?? deal.AutoDeal.IsMultidrive;
            deal.ChangesStartDate = updateDeal.ChangeDate;
            deal.AutoDeal.DriverMinAge = updateDeal.MinimalAge ?? deal.AutoDeal.DriverMinAge;
            deal.AutoDeal.DriverMinExperience = updateDeal.MinimalDrivingExperience ?? deal.AutoDeal.DriverMinExperience;

            var a1 = deal.DealConditionGroups?
                .SelectMany(s => s.InsuranceObjectConditions)
                .SelectMany(s => s.DealCoverages)
                .SelectMany(x => x.DealRisks)
                .ToList();

            var existRisk = deal.DealConditionGroups?
                .SelectMany(s => s.InsuranceObjectConditions)
                .SelectMany(s => s.DealCoverages)
                .SelectMany(x => x.DealRisks)
                .FirstOrDefault(x => x.StructId == updateDeal.Packet.Risks[0].StructId);

            if (existRisk != null)
            {
                existRisk.ProductRisk.RiskCode = updateDeal.Packet.Risks[0].Code;
            }
            else
            {
                var r = new DealRisk() 
                { 
                    StructId = updateDeal.Packet.Risks[0].StructId,
                    ProductRisk = new ProductRisk() { RiskCode = updateDeal.Packet.Risks[0].Code }
                };
                deal.DealConditionGroups.First().InsuranceObjectConditions.First().DealCoverages.First().DealRisks.Add(r);
            }

            var a = deal.DealConditionGroups?
            .SelectMany(s => s.InsuranceObjectConditions)
            .SelectMany(s => s.DealCoverages)
            .SelectMany(x => x.DealRisks)
            .ToList();

            //deal.SuggestedBanks.FirstOrDefault().Name = updateDeal.Auto.BankOfCredit ?? deal.SuggestedBanks?.FirstOrDefault()?.Name;
            //deal.SuggestedBanks.FirstOrDefault().BIK = updateDeal.Auto.BankOfCreditBik ?? deal.SuggestedBanks?.FirstOrDefault()?.BIK;
            var insurant = deal.Insurant;
            var owner = deal.GetOwner();
            var drivers = deal.AutoDeal.Drivers;
            var auto = deal.GetAuto();
            var tsIdentityCard = deal.AutoDeal?.TsIdentityCard;

            UpdateOwner(updateOwner, owner);
            UpdateInsurant(updateInsurant, insurant);
            UpdateDrivers(updateDrivers, drivers);
            UpdateAuto(updateAuto, auto);
            UpdateTsIdentityCard(updateTsIdentityCard, tsIdentityCard);

            var autoDictionaryBasketUpdater = ServiceProvider.GetRequiredService<IAutoDictionaryBasketUpdater>();
            autoDictionaryBasketUpdater.UpdateAutoDictionaryValues(basket);
        }
У меня сейчас обрабатывается только первый элемент Risks и DealRisks Как мне исправить что бы все обрабатывались?