public async Task <Page <Vehicle> > GetAllAsync(PagingOptions pagingOptions) { IQueryable <Vehicle> query; using (IDbConnection connection = _vehiclesRepository.Connection) { query = (await _vehiclesRepository.GetAllAsync()).AsQueryable(); } var size = query.Count(); var items = query .Skip(pagingOptions.Offset.Value) .Take(pagingOptions.Limit.Value) .ToArray(); return(new Page <Vehicle> { Items = items, TotalSize = size }); }