public IActionResult List(string searchString, string sortOrder,
                                  string sortType, int offset, int limit, int?Id)
        {
            if (Id.HasValue)
            {
                return(Ok(_databaseContext.Products.Where(product => product.Id == Id)));
            }
            else
            {
                List <Product> pagedProducts = _cacheClient.GetProducts(searchString, sortOrder, sortType, offset, limit);

                if (pagedProducts is null)
                {
                    List <Product> products = Search(_databaseContext.Products.ToList(), searchString);
                    products = Sort(products, sortOrder, sortType);

                    if (offset < 1 || offset == 0)
                    {
                        offset = 1;
                    }
                    if (limit < 1 || limit == 0)
                    {
                        limit = products.Count();
                    }

                    pagedProducts = products
                                    .Skip((offset - 1) * limit)
                                    .Take(limit).ToList();

                    _cacheClient.SetProducts(searchString, sortOrder, sortType, offset, limit, pagedProducts);
                }

                return(Ok(new { products = pagedProducts, count = _databaseContext.Products.Count() }));
            }
        }