public async Task <Stream> DownloadAvatarAsync(string url)
        {
            if (string.IsNullOrEmpty(url))
            {
                throw new ArgumentNullException(nameof(url));
            }

            WebRequest request = WebRequest.Create(url);

            request.Headers.Add(HttpHeaders.Authorization, "Basic " + AzureDevOpsPullRequestServices.FormatBasicAuthHeader(new NetworkCredential("pat", this.clientContext.PersonalAccessToken)));

            // TODO: put timeout here
            request.Timeout = -1;

            WebResponse response = await request.GetResponseAsync();

            Stream responseStream = response.GetResponseStream();

            return(responseStream);
        }
        public async Task <IEnumerable <IPullRequest> > GetPullRequestsAsync(PullRequestState status, string userUniqueId = null)
        {
            IEnumerable <GitPullRequest> pullRequests = await this.client.GetPullRequestsByProjectAsync(this.project, new GitPullRequestSearchCriteria()
            {
                RepositoryId = this.repo.Id, Status = AzureDevOpsPullRequestServices.ConvertToAzDOStatus(status)
            });

            List <IPullRequest> trackerPullRequests = new List <IPullRequest>();

            foreach (GitPullRequest pullRequest in pullRequests)
            {
                // Want to exclude anything that the user has approved
                if (!string.IsNullOrEmpty(userUniqueId) && pullRequest.Reviewers.Any(reviewer => reviewer.UniqueName == userUniqueId && reviewer.Vote > 0))
                {
                    continue;
                }

                DateTime changedStateDate             = pullRequest.Status == PullRequestStatus.Completed || pullRequest.Status == PullRequestStatus.Abandoned ? pullRequest.ClosedDate : pullRequest.CreationDate;
                User     createdBy                    = new User(pullRequest.CreatedBy.ImageUrl, pullRequest.CreatedBy.DisplayName);
                IEnumerable <IUserWithVote> reviewers = pullRequest.Reviewers.Select(reviewer => new UserWithVote(reviewer.ImageUrl, reviewer.DisplayName, AzureDevOpsPullRequestServices.ConvertToTrackerVote(reviewer.Vote)));

                PullRequest trackerPullRequest = new PullRequest(
                    this.clientContext.AccountName,
                    pullRequest.TargetRefName,
                    changedStateDate,
                    createdBy,
                    pullRequest.PullRequestId,
                    this.project,
                    this.repo.Name,
                    reviewers,
                    AzureDevOpsPullRequestServices.ConvertToTrackerState(pullRequest.Status),
                    pullRequest.Title,
                    pullRequest.Url);

                trackerPullRequests.Add(trackerPullRequest);
            }

            return(trackerPullRequests);
        }