/// <summary>
        /// Get the next set of emails async.
        /// </summary>
        /// <returns>Task which returns all the pages for the next set of emails.</returns>
        private async Task <IEnumerable <Email> > GetEmailsAsync()
        {
            try
            {
                await UpdatePages();

                IList <Email> emails = new List <Email>();
                ProcessMessages(ref emails);

                while (_nextEmailPageRequest != null)
                {
                    _curEmailPage = await _nextEmailPageRequest.GetAsync();

                    ProcessMessages(ref emails);
                    _nextEmailPageRequest = _curEmailPage.NextPageRequest;
                }
                return(emails);
            }

            catch (ServiceException ex)
            {
                Console.WriteLine("Error getting emails:");
                Console.WriteLine(ex);
                return(null);
            }
        }
        /// <summary>
        /// Update to the next set of pages.
        /// </summary>
        /// <returns>Task containing the next set of pages.</returns>
        private async Task UpdatePages()
        {
            _curEmailPage = await _nextEmailPageRequest.GetAsync();

            _nextEmailPageRequest = _curEmailPage.NextPageRequest;
        }