async Task<double> GetOrderTotalForCategoryAsync(IEnumerable<Order> orders, CatalogCategory category, int numberOfWeeks = 6, bool isOpen = false)
        {
            double total = 0;

            var categoryProducts = await _CatalogClient.GetAllChildProductsAsync(category.Id);

            DateTime dateEnd = DateTime.UtcNow;
            DateTime dateStart = dateEnd.AddDays(-numberOfWeeks * 7);

            IEnumerable<Order> results;

            if (isOpen)
            {
                results = orders.Where(
                    order => order.IsOpen == isOpen &&
                    order.OrderDate >= dateStart &&
                    order.OrderDate <= dateEnd &&
                    categoryProducts.Any(product => product.Name.ToLower() == order.Item.ToLower()));
            }
            else
            {
                results = orders.Where(
                    order => order.IsOpen == isOpen &&
                    order.ClosedDate >= dateStart &&
                    order.ClosedDate <= dateEnd &&
                    categoryProducts.Any(product => product.Name.ToLower() == order.Item.ToLower()));
            }
                
            foreach (var order in results)
            {
                total += order.Price;
            }

            return total;
        }
        public CategoriesViewModel(CatalogCategory category = null)
        {
            Category = category;

            SubCategories = new ObservableCollection<CatalogCategory>();

            _CatalogClient = DependencyService.Get<ICatalogDataClient>();

        }