public async Task <PagedResponse <IEnumerable <GetAllProductsViewModel> > > Handle(GetAllProductsQuery request, CancellationToken cancellationToken)
        {
            var pageSize     = request.PageSize < 1 ? _paginationSettings.PageSize : request.PageSize;
            int totalRecords = await _productRepository.CountAsync();

            var validRequest = new RequestParameter(request.PageNumber, pageSize);

            if (request.PageNumber == 0) // get All
            {
                validRequest = new RequestParameter(1, totalRecords);
                //var data = await _productRepository.GetAllAsync();
                var data = await _productRepository.GetAllIncludingAsync(x => x.ProductCategory);

                var allProductViewModel = _mapper.Map <IEnumerable <GetAllProductsViewModel> >(data);
                return(new PagedResponse <IEnumerable <GetAllProductsViewModel> >(allProductViewModel, validRequest, totalRecords));
            }

            //var products =  _productRepository.GetAllIncluding(x=>x.ProductCategory);
            //var dataPaged = products.Skip((validRequest.PageNumber - 1) * pageSize)
            //    .Take(pageSize);
            var dataPaged = await _productRepository.GetPagedResponseAsync(validRequest.PageNumber, validRequest.PageSize, "ProductCategory");

            var productsViewModel = _mapper.Map <IEnumerable <GetAllProductsViewModel> >(dataPaged);

            return(new PagedResponse <IEnumerable <GetAllProductsViewModel> >(productsViewModel, validRequest, totalRecords));
        }