public async Task<Account> GetAccountAsync()
{
Account account;
if (!this.accountInitialized)
{
account = await this.authenticationManager.GetCurrentVSAccountAsync();
await this.SetAccountAsync(account);
}
else
{
// The account is an immutable object, therefore it needs to be retrieved from the store each
// time in order to get the most recent state (e.g. NeedsReauthentication).
account = this.accountManager.Store.GetAllAccounts()
.FirstOrDefault(a => AccountKey.KeyComparer.Equals(this.accountKey, a));
}
return account;
}