public Task <PaginatedResponseContract <AccountStatContract> > GetAllAccountStatsByPages( int?skip = null, int?take = null) { if ((skip.HasValue && !take.HasValue) || (!skip.HasValue && take.HasValue)) { throw new ArgumentOutOfRangeException(nameof(skip), "Both skip and take must be set or unset"); } if (take.HasValue && (take <= 0 || skip < 0)) { throw new ArgumentOutOfRangeException(nameof(skip), "Skip must be >= 0, take must be > 0"); } var stats = _accountsCacheService.GetAllByPages(skip, take); return(Task.FromResult(Convert(stats))); }