protected async Task Startup()
        {
            if (!_applicationService.Accounts.Any())
            {
                GoToLoginCommand.Execute(null);
                return;
            }

            var account = GetDefaultAccount();

            if (account == null)
            {
                GoToAccountsCommand.Execute(null);
                return;
            }

            if (string.IsNullOrEmpty(account.Token) || string.IsNullOrEmpty(account.RefreshToken))
            {
                await AlertService.Alert("Welcome!", "CodeBucket is now OAuth compliant!\n\nFor your security, " +
                                         "you will now be prompted to login to Bitbucket via their OAuth portal. This will swap out your credentials" +
                                         " for an OAuth token you may revoke at any time!");

                GoToLoginCommand.Execute(null);
                return;
            }

            try
            {
                IsLoggingIn = true;
                Status      = "Logging in as " + account.Username;

                var ret = await Task.Run(() => Client.RefreshToken(LoginViewModel.ClientId, LoginViewModel.ClientSecret, account.RefreshToken));

                if (ret == null)
                {
                    await DisplayAlert("Unable to refresh OAuth token. Please login again.");

                    GoToLoginCommand.Execute(null);
                    return;
                }

                account.RefreshToken = ret.RefreshToken;
                account.Token        = ret.AccessToken;
                _accountsService.Update(account);

                await AttemptLogin(account);

                GoToMenuCommand.Execute(null);
            }
            catch (Exception e)
            {
                DisplayAlert("Unable to login successfully: " + e.Message).FireAndForget();
                GoToAccountsCommand.Execute(null);
            }
            finally
            {
                IsLoggingIn = false;
            }
        }
 private void GoToAccountsOrNewUser()
 {
     if (AccountsService.Any())
     {
         GoToAccountsCommand.Execute(null);
     }
     else
     {
         GoToNewUserCommand.Execute(null);
     }
 }