private PriceList CreatePriceList(Website webSite, StructureInfo structureInfo) { var priceList = _priceListService.Get(webSite.Id.Replace(" ", "")); if (priceList != null) { return(priceList); } var currency = _currencyService.Get(structureInfo.ProductCatalog.CurrencyId) ?? _currencyService.GetBaseCurrency(); priceList = new PriceList(structureInfo.Id(currency.SystemId)) { Id = webSite.Id.Replace(" ", ""), Active = structureInfo.ProductCatalog.PriceList?.Active ?? true, AccessControlList = structureInfo.ProductCatalog.PriceList.AccessControlList.MakeWritable() }; if (structureInfo.ProductCatalog.PriceList?.WebSiteLinks.Any(x => structureInfo.Id(x.WebSiteSystemId) == structureInfo.Website.Website.SystemId) ?? false) { priceList.WebSiteLinks.Add(new PriceListToWebSiteLink(webSite.SystemId)); } foreach (var language in Solution.Instance.Languages) { priceList.Localizations[language.Culture].Name = webSite.Localizations[language.Culture].Name; } _priceListService.Create(priceList); if (structureInfo.ProductCatalog.PriceList != null) { structureInfo.Mappings.Add(structureInfo.ProductCatalog.PriceList.SystemId, priceList.SystemId); } return(priceList); }