public virtual void Patch(StoreEntity target)
        {
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }

            target.AdminEmail        = AdminEmail;
            target.Catalog           = Catalog;
            target.Country           = Country;
            target.DefaultCurrency   = DefaultCurrency;
            target.DefaultLanguage   = DefaultLanguage;
            target.Description       = Description;
            target.DisplayOutOfStock = DisplayOutOfStock;
            target.Email             = Email;
            target.ModifiedBy        = ModifiedBy;
            target.ModifiedDate      = ModifiedDate;
            target.Name                       = Name;
            target.Region                     = Region;
            target.SecureUrl                  = SecureUrl;
            target.TimeZone                   = TimeZone;
            target.Url                        = Url;
            target.StoreState                 = StoreState;
            target.FulfillmentCenterId        = FulfillmentCenterId;
            target.ReturnsFulfillmentCenterId = ReturnsFulfillmentCenterId;

            if (!Languages.IsNullCollection())
            {
                var languageComparer = AnonymousComparer.Create((StoreLanguageEntity x) => x.LanguageCode);
                Languages.Patch(target.Languages, languageComparer,
                                (sourceLang, targetLang) => targetLang.LanguageCode = sourceLang.LanguageCode);
            }
            if (!Currencies.IsNullCollection())
            {
                var currencyComparer = AnonymousComparer.Create((StoreCurrencyEntity x) => x.CurrencyCode);
                Currencies.Patch(target.Currencies, currencyComparer,
                                 (sourceCurrency, targetCurrency) => targetCurrency.CurrencyCode = sourceCurrency.CurrencyCode);
            }
            if (!TrustedGroups.IsNullCollection())
            {
                var trustedGroupComparer = AnonymousComparer.Create((StoreTrustedGroupEntity x) => x.GroupName);
                TrustedGroups.Patch(target.TrustedGroups, trustedGroupComparer,
                                    (sourceGroup, targetGroup) => sourceGroup.GroupName = targetGroup.GroupName);
            }

            if (!FulfillmentCenters.IsNullCollection())
            {
                var fulfillmentCenterComparer = AnonymousComparer.Create((StoreFulfillmentCenterEntity fc) => $"{fc.FulfillmentCenterId}-{fc.Type}");
                FulfillmentCenters.Patch(target.FulfillmentCenters, fulfillmentCenterComparer,
                                         (sourceFulfillmentCenter, targetFulfillmentCenter) => sourceFulfillmentCenter.Patch(targetFulfillmentCenter));
            }
            if (!SeoInfos.IsNullCollection())
            {
                SeoInfos.Patch(target.SeoInfos, (sourceSeoInfo, targetSeoInfo) => sourceSeoInfo.Patch(targetSeoInfo));
            }
        }
        public virtual Store ToModel(Store store)
        {
            if (store == null)
            {
                throw new ArgumentNullException(nameof(store));
            }

            store.Id                             = Id;
            store.AdminEmail                     = AdminEmail;
            store.Catalog                        = Catalog;
            store.Country                        = Country;
            store.CreatedBy                      = CreatedBy;
            store.CreatedDate                    = CreatedDate;
            store.DefaultCurrency                = DefaultCurrency;
            store.DefaultLanguage                = DefaultLanguage;
            store.Description                    = Description;
            store.DisplayOutOfStock              = DisplayOutOfStock;
            store.Email                          = Email;
            store.ModifiedBy                     = ModifiedBy;
            store.ModifiedDate                   = ModifiedDate;
            store.Name                           = Name;
            store.Region                         = Region;
            store.SecureUrl                      = SecureUrl;
            store.TimeZone                       = TimeZone;
            store.Url                            = Url;
            store.MainFulfillmentCenterId        = FulfillmentCenterId;
            store.MainReturnsFulfillmentCenterId = ReturnsFulfillmentCenterId;

            store.StoreState    = EnumUtility.SafeParse(StoreState.ToString(), Core.Model.StoreState.Open);
            store.Languages     = Languages.Select(x => x.LanguageCode).ToList();
            store.Currencies    = Currencies.Select(x => x.CurrencyCode).ToList();
            store.TrustedGroups = TrustedGroups.Select(x => x.GroupName).ToList();
            store.AdditionalFulfillmentCenterIds = FulfillmentCenters.Where(x => x.Type == FulfillmentCenterType.Main).Select(x => x.FulfillmentCenterId).ToList();
            store.ReturnsFulfillmentCenterIds    = FulfillmentCenters.Where(x => x.Type == FulfillmentCenterType.Returns).Select(x => x.FulfillmentCenterId).ToList();
            // SeoInfos
            store.SeoInfos = SeoInfos.Select(x => x.ToModel(AbstractTypeFactory <SeoInfo> .TryCreateInstance())).ToList();

            return(store);
        }
 public FulfillmentCenter[] GetFulfillmentCentersByIds(string[] ids)
 {
     return(FulfillmentCenters.Where(x => ids.Contains(x.Id)).ToArray());
 }