public List <BigCommerceCategory> GetCategories()
        {
            var categories = new List <BigCommerceCategory>();
            var marker     = this.GetMarker();

            for (var i = 1; i < int.MaxValue; i++)
            {
                var endpoint             = "";    //mainEndpoint.ConcatParams(ParamsBuilder.CreateGetNextPageParams(new BigCommerceCommandConfig(i, RequestMaxLimit)));
                var categoriesWithinPage = ActionPolicy.Handle <Exception>().Retry(ActionPolicies.RetryCount, (ex, retryAttempt) =>
                {
                    if (PageAdjuster.TryAdjustPageIfResponseTooLarge(new PageInfo(i, this.RequestMaxLimit), this.RequestMinLimit, ex, out var newPageInfo))
                    {
                        i = newPageInfo.Index;
                        this.RequestMaxLimit = newPageInfo.Size;
                    }

                    ActionPolicies.LogRetryAndWait(ex, marker, endpoint, retryAttempt);
                }).Get(() => {
                    return(this._webRequestServices.GetResponseByRelativeUrl <BigCommerceCategoryInfoData>(BigCommerceCommand.GetCategoriesV3, endpoint, marker));
                });

                this.CreateApiDelay(categoriesWithinPage.Limits).Wait();                 //API requirement

                if (categoriesWithinPage.Response == null)
                {
                    break;
                }

                foreach (var category in categoriesWithinPage.Response.Data)
                {
                    var CatURL = category.Category_URL;

                    categories.Add(new BigCommerceCategory
                    {
                        Id           = category.Id,
                        Category_URL = new BigCommerceCategoryURL()
                        {
                            Url = CatURL.Url
                        },
                        Category_Name = category.Name,
                        IsVisible     = category.IsVisible
                    });
                }

                if (categoriesWithinPage.Response.Data.Length < RequestMaxLimit)
                {
                    break;
                }
            }


            return(categories);
        }
        public List <BigCommerceProduct> GetProducts(bool includeExtendedInfo)
        {
            var mainEndpoint = "?include=variants,images";
            var products     = new List <BigCommerceProduct>();
            var marker       = this.GetMarker();

            for (var i = 1; i < int.MaxValue; i++)
            {
                var endpoint           = mainEndpoint.ConcatParams(ParamsBuilder.CreateGetNextPageParams(new BigCommerceCommandConfig(i, RequestMaxLimit)));
                var productsWithinPage = ActionPolicy.Handle <Exception>().Retry(ActionPolicies.RetryCount, (ex, retryAttempt) =>
                {
                    if (PageAdjuster.TryAdjustPageIfResponseTooLarge(new PageInfo(i, this.RequestMaxLimit), this.RequestMinLimit, ex, out var newPageInfo))
                    {
                        i = newPageInfo.Index;
                        this.RequestMaxLimit = newPageInfo.Size;
                    }

                    ActionPolicies.LogRetryAndWait(ex, marker, endpoint, retryAttempt);
                }).Get(() => {
                    return(this._webRequestServices.GetResponseByRelativeUrl <BigCommerceProductInfoData>(BigCommerceCommand.GetProductsV3, endpoint, marker));
                });

                this.CreateApiDelay(productsWithinPage.Limits).Wait();                 //API requirement

                if (productsWithinPage.Response == null)
                {
                    break;
                }

                foreach (var product in productsWithinPage.Response.Data)
                {
                    var productImageThumbnail = product.Images.FirstOrDefault(img => img.IsThumbnail);

                    var additional_images = product.Images;

                    var custom_url = product.Product_URL;

                    products.Add(new BigCommerceProduct
                    {
                        Id = product.Id,
                        InventoryTracking = this.ToCompatibleWithV2InventoryTrackingEnum(product.InventoryTracking),
                        Upc               = product.Upc,
                        Sku               = product.Sku,
                        Name              = product.Name,
                        Description       = product.Description,
                        Price             = product.Price,
                        IsProductVisible  = product.IsVisible,
                        Condition         = product.Condition,
                        Availability      = product.Availability,
                        ProductType       = product.Type,
                        SalePrice         = product.SalePrice,
                        RetailPrice       = product.RetailPrice,
                        CostPrice         = product.CostPrice,
                        Weight            = product.Weight,
                        BrandId           = product.BrandId,
                        Quantity          = product.Quantity,
                        Product_URL       = custom_url.ProductURL,
                        Categories        = product.Categories,
                        ThumbnailImageURL = new BigCommerceProductPrimaryImages()
                        {
                            StandardUrl = productImageThumbnail != null ? productImageThumbnail.UrlStandard : string.Empty
                        },
                        ProductOptions = product.Variants.Select(x => new BigCommerceProductOption
                        {
                            Id        = x.Id,
                            ProductId = x.ProductId,
                            Sku       = x.Sku,
                            Quantity  = x.Quantity,
                            Upc       = x.Upc,
                            Price     = x.Price,
                            CostPrice = x.CostPrice,
                            Weight    = x.Weight,
                            ImageFile = x.ImageUrl
                        }).ToList(),
                        Main_Images = product.Images.Select(y => new BigCommerceImage
                        {
                            UrlStandard = y.UrlStandard,
                            IsThumbnail = y.IsThumbnail
                        }).ToList()
                    });
                }

                if (productsWithinPage.Response.Data.Count < RequestMaxLimit)
                {
                    break;
                }
            }

            if (includeExtendedInfo)
            {
                base.FillWeightUnit(products, marker);
                base.FillBrands(products, marker);
            }

            return(products);
        }