protected int GetCatalog(bool fullExtraction = false)
        {
            int itemCount, catalogCount;
            string status;

            //clear the exclusion causess before catalog extraction starts
            ExclusionCauses.Clear();
            ExclusionStats.Clear();
            if (Rules.MigrationRules != null) Rules.MigrationRules.BeginMapping(Progress);
            //if (Rules.MigrationRules != null && Rules.MigrationRules.Enabled)
                    //MigrationSubMap = new Dictionary<string, string>();

            #if !CART_EXTRACTOR_TEST_SITE
            if (Rules.InvalidatePricesOnExtract)
                Task.Factory.StartNew(() => ClientData.Instance.InvalidatePrices(Alias));
            #endif

            //------------------DepartmentNames.txt------------------
            if (Rules.ExportDepartmentNames || Rules.UseDepartmentsAsCategories)
            {
                Progress.StartTable("Department Names", "items");
                status = GetDepartmentNames(out itemCount);
                Progress.EndTable(itemCount, status);
            }

            //------------------Catalog.txt------------------
            Progress.StartTable("Catalog", "items");
            _catalogFileSeekPosition = 0L;
            status = GetCatalog(out catalogCount);
            Products = null; //release the memory
            if (_migrationSlave) status = Rules.MigrationRules.MapStatus; //adjust status for migration slave
            //if (_migrationSlave) //adjust status for migration slave
            //	status = MigrationSubMap.Any() ? "Migration Map Created" : "Migration Map is empty";
            Progress.EndTable(catalogCount, status);

            if (!_migrationSlave) //don't need additional files for migration
            {
                //------------------Exclusions.txt------------------
                Progress.StartTable("Exclusions", "items");
                status = GetExclusions(out itemCount);
                Progress.EndTable(itemCount, status);

                //------------------ExclusionCauses.txt------------------
                Progress.StartTable("ExclusionCauses", "items");
                status = GetExclusionCauses(out itemCount);
                Progress.EndTable(itemCount, status);

                //------------------Replacements.txt------------------
                Progress.StartTable("Replacements", "items");
                status = GetReplacements(out itemCount);
                Progress.EndTable(itemCount, status);

                //------------------Attribute1Items.txt------------------
                Progress.StartTable(Rules.Fields.Att1Name + " Names", "items");
                status = GetAtt1Names(out itemCount);
                Progress.EndTable(itemCount, status);

                //------------------Attribute2Items.txt------------------
                Progress.StartTable(Rules.Fields.Att2Name + " Names", "items");
                status = GetAtt2Names(out itemCount);
                Progress.EndTable(itemCount, status);

                //------------------FeaturedCrossSell.txt------------------
                Progress.StartTable("FeaturedCrossSell", "items");
                status = GetFeaturedCrossSellRecs(out itemCount);
                Progress.EndTable(itemCount, status);

                //------------------FeaturedUpSell.txt------------------
                Progress.StartTable("FeaturedUpSell", "items");
                status = GetFeaturedUpSellRecs(out itemCount);
                Progress.EndTable(itemCount, status);

                //------------------AltPrices.txt------------------
                Progress.StartTable("Alternate Prices", "items");
                status = GetAltPrices(out itemCount);
                Progress.EndTable(itemCount, status);

                //------------------AltPageLinks.txt------------------
                Progress.StartTable("Alternate Page Links", "items");
                status = GetAltPageLinks(out itemCount);
                Progress.EndTable(itemCount, status);

                //------------------AltImageLinks.txt------------------
                Progress.StartTable("Alternate Image Links", "items");
                status = GetAltImageLinks(out itemCount);
                Progress.EndTable(itemCount, status);

                //------------------AltTitles.txt------------------
                Progress.StartTable("Alternate Titles", "items");
                status = GetAltTitles(out itemCount);
                Progress.EndTable(itemCount, status);

                //------------------ConfigBoost.txt------------------
                Progress.StartTable("Config", "rows");
                status = GetConfig(out itemCount);
                Progress.EndTable(itemCount, status);
            }
            //release memory
            Exclusions = new List<ExclusionRecord>();
            Replacements = new List<ReplacementRecord>();
            FeaturedCrossSells = new FeaturedRecommendations();
            FeaturedUpSells = new FeaturedRecommendations();
            ParentProducts = new Dictionary<string, ParentItem>();
            AltPrices = new Dictionary<string, List<string>>();
            AltPageLinks = new Dictionary<string, List<string>>();
            AltImageLinks = new Dictionary<string, List<string>>();
            AltTitles = new Dictionary<string, List<string>>();
            Departments = new Dictionary<string, string>();

            //special handling for cart migration
            if (fullExtraction && Rules.MigrationRules != null)
                Rules.MigrationRules.ProcessMap();

            #if !CART_EXTRACTOR_TEST_SITE
            if (Rules.InvalidatePricesOnExtractComplete)
                Task.Factory.StartNew(() => ClientData.Instance.InvalidatePrices(Alias));
            #endif
            return catalogCount;
        }
        private void ReleaseGlobalData()
        {
            Catalog.Reset();
            Inventory.Reset();
            Sales.Reset();
            Customers.Reset();
            CategoryNames.Reset();
            BrandNames.Reset();
            DepartmentNames.Reset();

            Products = new List<ProductRecord>();
            FeaturedCrossSells = new FeaturedRecommendations();
            FeaturedUpSells = new FeaturedRecommendations();
            ExclusionStats = new Dictionary<string, int>();

            //TODO: Move all below to the CatalogHandler class or depricate
            Exclusions = new List<ExclusionRecord>();
            Replacements = new List<ReplacementRecord>();
            ParentProducts = new Dictionary<string, ParentItem>();
            AltPrices = new Dictionary<string, List<string>>();
            AltPageLinks = new Dictionary<string, List<string>>();
            AltImageLinks = new Dictionary<string, List<string>>();
            AltTitles = new Dictionary<string, List<string>>();
            Departments = new Dictionary<string, string>();
            ExclusionCauses = new Dictionary<string, string>();
        }
        protected CartExtractor(SiteRules rules)
        {
            if (rules == null) throw new NoNullAllowedException("CartExtractor Rules cannot be null");
            Rules = rules;
            Alias = Rules.Alias;
            DataReadPath = IO.DataPath.Instance.ClientDataPath(ref Alias, true);
            DataWritePath = IO.DataPath.Instance.ClientDataPath(Alias, true);
            Progress = new ExtractorProgress();
            IsExtractorQueued = false;
            IsExtracting = false;

            #if !CART_EXTRACTOR_TEST_SITE
            BoostService = RestAccess.Instance;
            FeaturedCrossSells = new FeaturedRecommendations();
            FeaturedUpSells = new FeaturedRecommendations();
            #endif
            ExclusionStats = new Dictionary<string, int>();
            Catalog = new CatalogHandler(Rules, this, Progress);
            Inventory = new InventoryHandler(Rules, this, Progress);
            Sales = new SalesHandler(Rules, this, Progress);
            Customers = new CustomerHandler(Rules, this, Progress);
            CategoryNames = new AttributeHandler(Rules, this, Progress, DataGroup.CategoryNames);
            BrandNames = new AttributeHandler(Rules, this, Progress, DataGroup.ManufacturerNames);
            DepartmentNames = new AttributeHandler(Rules, this, Progress, DataGroup.DepartmentNames);

            //TODO: Move all below to the CatalogHandler class or depricate
            Exclusions = new List<ExclusionRecord>();
            Replacements = new List<ReplacementRecord>();
            ParentProducts = new Dictionary<string, ParentItem>();
            AltPrices = new Dictionary<string, List<string>>();
            AltPageLinks = new Dictionary<string, List<string>>();
            AltImageLinks = new Dictionary<string, List<string>>();
            AltTitles = new Dictionary<string, List<string>>();
            Departments = new Dictionary<string, string>();
            ExclusionCauses = new Dictionary<string, string>();
        }