public async Task SeedAsync(SmartDbContext context, CancellationToken cancelToken = default)
        {
            Guard.NotNull(context, nameof(context));

            _db = context;
            _data.Initialize(_db, _config.Language, EngineContext.Current.Application);
            _cancelToken = cancelToken;

            _db.ChangeTracker.AutoDetectChangesEnabled = false;
            _db.MinHookImportance = HookImportance.Essential;

            _config.ProgressMessageCallback("Progress.CreatingRequiredData");

            // special mandatory (non-visible) settings
            await _db.MigrateSettingsAsync(x =>
            {
                x.Add("Media.Storage.Provider", _config.StoreMediaInDB ? DatabaseMediaStorageProvider.SystemName : FileSystemMediaStorageProvider.SystemName);
            });

            await Populate("PopulatePictures", _data.Pictures().Where(x => x != null));
            await Populate("PopulateCurrencies", PopulateCurrencies);
            await Populate("PopulateStores", PopulateStores);
            await Populate("InstallLanguages", () => PopulateLanguage(_config.Language));
            await Populate("PopulateMeasureDimensions", _data.MeasureDimensions());
            await Populate("PopulateMeasureWeights", _data.MeasureWeights());
            await Populate("PopulateTaxCategories", PopulateTaxCategories);
            await Populate("PopulateCountriesAndStates", PopulateCountriesAndStates);
            await Populate("PopulateShippingMethods", PopulateShippingMethods);
            await Populate("PopulateDeliveryTimes", _data.DeliveryTimes());
            await Populate("PopulateQuantityUnits", _data.QuantityUnits());
            await Populate("PopulateCustomersAndUsers", async() => await PopulateCustomersAndUsers(_config.DefaultUserName, _config.DefaultUserPassword));
            await Populate("PopulateEmailAccounts", _data.EmailAccounts());
            await Populate("PopulateMessageTemplates", PopulateMessageTemplates);
            await Populate("PopulateTopics", PopulateTopics);
            await Populate("PopulateSettings", PopulateSettings);
            await Populate("PopulateActivityLogTypes", _data.ActivityLogTypes());
            await Populate("PopulateCustomersAndUsers", async() => await HashDefaultCustomerPassword(_config.DefaultUserName, _config.DefaultUserPassword));
            await Populate("PopulateProductTemplates", _data.ProductTemplates());
            await Populate("PopulateCategoryTemplates", _data.CategoryTemplates());
            await Populate("PopulateManufacturerTemplates", _data.ManufacturerTemplates());
            await Populate("PopulateScheduleTasks", _data.TaskDescriptors());
            await Populate("PopulateLocaleResources", async() => await PopulateLocaleResources(_config.Language));
            await Populate("PopulateMenus", _data.Menus());

            if (_config.SeedSampleData)
            {
                _logger.Info("Seeding sample data");

                _config.ProgressMessageCallback("Progress.CreatingSampleData");

                await Populate("PopulateSpecificationAttributes", _data.SpecificationAttributes());
                await Populate("PopulateProductAttributes", _data.ProductAttributes());
                await Populate("PopulateProductAttributeOptionsSets", _data.ProductAttributeOptionsSets());
                await Populate("PopulateProductAttributeOptions", _data.ProductAttributeOptions());
                await Populate("PopulateCampaigns", _data.Campaigns());
                await Populate("PopulateRuleSets", _data.RuleSets());
                await Populate("PopulateDiscounts", _data.Discounts());
                await Populate("PopulateCategories", PopulateCategories);
                await Populate("PopulateManufacturers", PopulateManufacturers);
                await Populate("PopulateProducts", PopulateProducts);
                await Populate("PopulateProductBundleItems", _data.ProductBundleItems());
                await Populate("PopulateProductVariantAttributes", _data.ProductVariantAttributes());
                await Populate("ProductVariantAttributeCombinations", _data.ProductVariantAttributeCombinations());
                await Populate("PopulateProductTags", _data.ProductTags());

                ////////await Populate("PopulateForumsGroups", _data.ForumGroups());
                ////////await Populate("PopulateForums", _data.Forums());
                ////////await Populate("PopulateBlogPosts", PopulateBlogPosts);
                ////////await Populate("PopulateNews", PopulateNewsItems);
                ////////await Populate("PopulatePolls", _data.Polls());
                Populate("FinalizeSamples", () => _data.FinalizeSamples());
            }

            await Populate("MoveMedia", MoveMedia);

            // Perf
            _db.DetachEntities <BaseEntity>();
        }