public async Task InitializeAsync(LocalRepositoryModel repository, IConnection connection)
        {
            modelService = await modelServiceFactory.CreateAsync(connection);

            activeLocalRepo = repository;
            SourceBranch    = gitService.GetBranch(repository);

            var obs = modelService.ApiClient.GetRepository(repository.Owner, repository.Name)
                      .Select(r => CreateRemoteRepositoryModel(r))
                      .PublishLast();

            disposables.Add(obs.Connect());
            var githubObs = obs;

            githubRepository = githubObs.ToProperty(this, x => x.GitHubRepository);

            this.WhenAnyValue(x => x.GitHubRepository)
            .WhereNotNull()
            .Subscribe(r =>
            {
                TargetBranch = r.IsFork ? r.Parent.DefaultBranch : r.DefaultBranch;
            });

            githubObs.SelectMany(r =>
            {
                var b = Observable.Empty <BranchModel>();
                if (r.IsFork)
                {
                    b = modelService.GetBranches(r.Parent).Select(x =>
                    {
                        return(x);
                    });
                }
                return(b.Concat(modelService.GetBranches(r)));
            })
            .ToList()
            .ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(x =>
            {
                Branches    = x.ToList();
                Initialized = true;
            });

            var draftKey = GetDraftKey();

            await LoadInitialState(draftKey).ConfigureAwait(true);

            this.WhenAnyValue(
                x => x.PRTitle,
                x => x.Description,
                (t, d) => new PullRequestDraft {
                Title = t, Body = d
            })
            .Throttle(TimeSpan.FromSeconds(1), timerScheduler)
            .Subscribe(x => draftStore.UpdateDraft(draftKey, string.Empty, x));

            Initialized = true;
        }
        public async Task InitializeAsync(
            ILocalRepositoryModel localRepository,
            IConnection connection,
            string owner,
            string repo,
            int pullRequestNumber)
        {
            if (repo != localRepository.Name)
            {
                throw new NotSupportedException();
            }

            IsLoading = true;

            try
            {
                LocalRepository       = localRepository;
                RemoteRepositoryOwner = owner;
                session = await sessionManager.GetSession(owner, repo, pullRequestNumber).ConfigureAwait(true);
                await Load(session.PullRequest).ConfigureAwait(true);

                if (LocalRepository?.CloneUrl != null)
                {
                    var key = GetDraftKey();

                    if (string.IsNullOrEmpty(Body))
                    {
                        var draft = await draftStore.GetDraft <PullRequestReviewDraft>(key, string.Empty)
                                    .ConfigureAwait(true);

                        Body = draft?.Body;
                    }

                    this.WhenAnyValue(x => x.Body)
                    .Throttle(TimeSpan.FromSeconds(1), timerScheduler)
                    .Select(x => new PullRequestReviewDraft {
                        Body = x
                    })
                    .Subscribe(x => draftStore.UpdateDraft(key, string.Empty, x));
                }
            }
            finally
            {
                IsLoading = false;
            }
        }