public async Task <bool> LoginWithMicrosoftAsync()
        {
            bool succeeded = false;

            try
            {
                var result = await App.AuthenticationClient.AcquireTokenAsync(
                    new string[] { AppSettings.B2cClientId },
                    string.Empty,
                    UiOptions.SelectAccount,
                    string.Empty,
                    null,
                    $"{AppSettings.B2cAuthority}{AppSettings.B2cTenant}",
                    AppSettings.B2cPolicy);

                Models.User user = AuthenticationResultHelper.GetUserFromResult(result);
                user.AvatarUrl = _avatarProvider.GetAvatarUrl(user.Email);
                user.LoggedInWithMicrosoftAccount = true;
                AppSettings.User = user;

                succeeded = true;
            }
            catch (MsalException ex)
            {
                if (ex.ErrorCode != MsalError.AuthenticationCanceled)
                {
                    System.Diagnostics.Debug.WriteLine($"Error with MSAL authentication: {ex}");
                    throw new ServiceAuthenticationException();
                }
            }

            return(succeeded);
        }
        void SaveAuthenticationResult(AuthenticationResult result)
        {
            var user = AuthenticationResultHelper.GetUserFromResult(result);

            user.AvatarUrl   = avatarProvider.GetAvatarUrl(user.Email);
            AppSettings.User = user;
        }