/// <inheritdoc />
        public async Task <Person> FindFirstOrDefaultByNameAsync(string name, CancellationToken token = default(CancellationToken))
        {
            var enumerator = new PageEnvelopeEnumeratorAsync <PersonTable>((o, t) => _storage.Person.ReadAllWithPagingAsync(o, null, t), token);

            while (await enumerator.MoveNextAsync())
            {
                if (enumerator.Current.Name == name)
                {
                    return(await MapFromServerAsync(enumerator.Current, token));
                }
            }
            return(null);
        }
        /// <inheritdoc />
        public async Task DeleteAllAsync(CancellationToken token = new CancellationToken())
        {
            var personEnumerator = new PageEnvelopeEnumeratorAsync <Person>((offset, ct) => ReadAllWithPagingAsync(offset, null, ct), token);
            var tasks            = new List <Task>();

            while (await personEnumerator.MoveNextAsync())
            {
                token.ThrowIfCancellationRequested();
                var person = personEnumerator.Current;
                var task   = DeleteAsync(person.Id, token);
                tasks.Add(task);
            }

            await Task.WhenAll(tasks);
        }
        /// <inheritdoc />
        public async Task <Person> FindFirstOrDefaultByNameAsync(string name, CancellationToken token = default(CancellationToken))
        {
            InternalContract.RequireNotNullOrWhitespace(name, nameof(name));
            var enumerator =
                new PageEnvelopeEnumeratorAsync <Person>((offset, t) => ReadAllWithPagingAsync(offset, null, t), token);

            while (await enumerator.MoveNextAsync())
            {
                if (enumerator.Current.Name == name)
                {
                    return(enumerator.Current);
                }
            }

            return(null);
        }
        public async Task <List <StorageTest> > GetOldTests(TimeSpan maxAge)
        {
            var old = new List <StorageTest>();

            const int limit      = 100;
            var       enumerator = new PageEnvelopeEnumeratorAsync <StorageTest>((offset, ct) => ReadAllWithPagingAsync(PartitionKey, offset, limit, ct));

            while (await enumerator.MoveNextAsync())
            {
                var item = enumerator.Current;
                if (item.RecordCreatedAt.Add(maxAge) < DateTimeOffset.Now)
                {
                    old.Add(item);
                }
            }
            return(old);
        }