public DataTablesResponseData GetDataTablesResponse <TSource>(IEnumerable <TSource> data, bool disablePaging = false)
        {
            var filters          = new DataTablesFiltering();
            var outputProperties = DataTablesTypeInfo <TSource> .Properties;

            TSource[] queryResult;
            var       totalDisplayRecords = 0;
            var       filteredData        = filters.ApplyFiltersAndSort(this, data.AsQueryable(), outputProperties);

            if (!disablePaging)
            {
                totalDisplayRecords = filteredData.Count();
                var skipped = filteredData.Skip(this.iDisplayStart);
                queryResult = (this.iDisplayLength <= 0 ? skipped : skipped.Take(this.iDisplayLength)).ToArray();
            }
            else
            {
                queryResult         = filteredData.ToArray();
                totalDisplayRecords = queryResult.Count();
            }

            var result = new DataTablesResponseData()
            {
                iTotalRecords        = totalDisplayRecords,
                iTotalDisplayRecords = totalDisplayRecords,
                sEcho  = sEcho,
                aaData = queryResult.Cast <object>().ToArray(),
            };

            return(result);
        }
        public async Task <DataTablesResponseData> GetDataTablesResponseNoLockAsync <TSource>(IQueryable <TSource> data, Action <TSource> postQueryTransform, bool disablePaging = false)
        {
            var filters          = new DataTablesFiltering();
            var outputProperties = DataTablesTypeInfo <TSource> .Properties;

            List <TSource> queryResult;
            var            totalDisplayRecords = 0;
            var            filteredData        = filters.ApplyFiltersAndSort(this, data, outputProperties);

            if (!disablePaging)
            {
                totalDisplayRecords = await filteredData.CountNoLockAsync();

                var skipped = filteredData.Skip(this.iDisplayStart);
                queryResult = await(this.iDisplayLength <= 0 ? skipped : skipped.Take(this.iDisplayLength)).ToListNoLockAsync().ConfigureAwait(false);
            }
            else
            {
                queryResult = await filteredData.ToListNoLockAsync().ConfigureAwait(false);

                totalDisplayRecords = queryResult.Count();
            }

            queryResult.ForEach(postQueryTransform);

            var result = new DataTablesResponseData()
            {
                iTotalRecords        = totalDisplayRecords,
                iTotalDisplayRecords = totalDisplayRecords,
                sEcho  = this.sEcho,
                aaData = queryResult.Cast <object>().ToArray(),
            };

            return(result);
        }