private async Task <PagedResultDto <ItemDto> > GetListAsyncFromDatabase(GetItemListDto input, string key)
        {
            if (input.Sorting.IsNullOrWhiteSpace())
            {
                input.Sorting = nameof(Item.Name);
            }

            var items = await _itemRepository.GetListAsync(
                input.SkipCount,
                input.MaxResultCount,
                input.Sorting,
                input.Filter
                );

            var totalCount = 0;

            if (!CurrentTenant.Id.HasValue)
            {
                using (_dataFilter.Disable <IMultiTenant>())
                {
                    totalCount = input.Filter == null
                ? await _itemRepository.CountAsync()
                : await _itemRepository.CountAsync(
                        item => item.Name.Contains(input.Filter));
                }
            }
            else
            {
                totalCount = input.Filter == null
                ? await _itemRepository.CountAsync()
                : await _itemRepository.CountAsync(
                    item => item.Name.Contains(input.Filter));
            }

            await _cache_paged.SetAsync(key, ObjectMapper.Map <List <Item>, List <ItemDto> >(items));

            return(new PagedResultDto <ItemDto>(
                       totalCount,
                       ObjectMapper.Map <List <Item>, List <ItemDto> >(items)
                       ));
        }
        public async Task <PagedResultDto <ItemDto> > GetListAsync(GetItemListDto input)
        {
            var keyBuilder = new StringBuilder();

            foreach (var prop in input.GetType().GetProperties().OrderBy(x => x.Name))
            {
                keyBuilder.Append($"|{prop.Name}-{prop.GetValue(input)}");
            }
            string key         = "All_Items_List" + (keyBuilder.Length > 0 ? keyBuilder.ToString():  "");
            var    cashedItems = _cache_paged.Get(key);

            if (cashedItems == null)
            {
                return(await GetListAsyncFromDatabase(input, key));
            }
            else
            {
                return(new PagedResultDto <ItemDto>(
                           cashedItems.Count,
                           cashedItems
                           ));
            }



            /*
             *
             * if (input.Sorting.IsNullOrWhiteSpace())
             * {
             *  input.Sorting = nameof(Item.Name);
             * }
             *
             * var items = await _itemRepository.GetListAsync(
             *  input.SkipCount,
             *  input.MaxResultCount,
             *  input.Sorting,
             *  input.Filter
             * );
             *
             * var totalCount = 0;
             * if (!CurrentTenant.Id.HasValue)
             * {
             *  using (_dataFilter.Disable<IMultiTenant>())
             *  {
             *      totalCount = input.Filter == null
             *  ? await _itemRepository.CountAsync()
             *  : await _itemRepository.CountAsync(
             *      item => item.Name.Contains(input.Filter));
             *  }
             * }
             * else
             * {
             *  totalCount = input.Filter == null
             *  ? await _itemRepository.CountAsync()
             *  : await _itemRepository.CountAsync(
             *      item => item.Name.Contains(input.Filter));
             * }
             *
             *
             * return new PagedResultDto<ItemDto>(
             *  totalCount,
             *  ObjectMapper.Map<List<Item>, List<ItemDto>>(items)
             * );
             */
        }