private MerchantTribe.CommerceDTO.v1.Catalog.ClearProductsData DeleteSome(long storeId, int howMany)
        {

            List<Product> items = CatalogServices.Products.FindAllPaged(1, howMany);
            int totalCount = CatalogServices.Products.FindAllCount(storeId);
                       
            if (items != null)
            {
                foreach (Product p in items)
                {
                    this.DestroyProduct(p.Bvin);
                }
            }

            int left = totalCount - howMany;
            if (left < 0) left = 0;
            int cleared = howMany;
            if (totalCount < howMany) cleared = totalCount;
            MerchantTribe.CommerceDTO.v1.Catalog.ClearProductsData result = new CommerceDTO.v1.Catalog.ClearProductsData();
            result.ProductsCleared = cleared;
            result.ProductsRemaining = left;

            return result;
        }
        public MerchantTribe.CommerceDTO.v1.Catalog.ClearProductsData ClearProducts(int howMany)
        {
            MerchantTribe.CommerceDTO.v1.Catalog.ClearProductsData result = new CommerceDTO.v1.Catalog.ClearProductsData();

            DateTime current = DateTime.UtcNow;
            DateTime availableUntil = CurrentRequestContext.CurrentStore.Settings.AllowApiToClearUntil;
            int compareResult = DateTime.Compare(current, availableUntil);
            if (compareResult >= 0)
            {
                result.ProductsCleared = 0;
                result.ProductsRemaining = -1;
                return result;
            }

            return DeleteSome(CurrentRequestContext.CurrentStore.Id, howMany);
        }