public virtual async Task <EntityListWithCount <BenchmarkDto> > ListByUser(string userId, int numOfItems)
        {
            var entities = await this.m_db.Benchmark
                           .Where(t => t.OwnerId == userId)
                           .Include(b => b.BenchmarkTest)
                           .OrderByDescending(b => b.WhenCreated)
                           .ToListAsync()
                           .ConfigureAwait(false);

            var count  = entities.Count();
            var result = new EntityListWithCount <BenchmarkDto>(ProcessQueryResult(entities.Take(numOfItems)), count);

            return(result);
        }
        /// <summary>
        /// Returns total number of results for given benchmark
        /// Total # is needed to create pagination
        /// </summary>
        /// <returns></returns>
        public virtual async Task <EntityListWithCount <BenchmarkResultDto> > ListAll(int maxEntities, int benchmarkId)
        {
            Preconditions.ToBePositive(maxEntities);
            var list = await this.m_db.Result
                       .Where(t => t.BenchmarkId == benchmarkId)
                       .OrderByDescending(t => t.Created)
                       .ToListAsync()
                       .ConfigureAwait(false);

            long count = list.Count;
            IEnumerable <BenchmarkResultDto> dtos = ProcessQueryResult(list.Take(maxEntities));
            var result = new EntityListWithCount <BenchmarkResultDto>(dtos, count);

            return(result);
        }
        public virtual async Task <EntityListWithCount <BenchmarkDto> > ListAll(int maxEntities)
        {
            Preconditions.ToBePositive(maxEntities);

            var entities = await this.m_db.Benchmark
                           .Include(t => t.BenchmarkTest)
                           .OrderByDescending(t => t.WhenCreated)
                           .ToListAsync()
                           .ConfigureAwait(false);

            long count = entities.Count;
            IEnumerable <BenchmarkDto> dtos = ProcessQueryResult(entities.Take(maxEntities));
            var result = new EntityListWithCount <BenchmarkDto>(dtos, count);

            return(result);
        }