/// <summary>
        /// Login the user from Azure AD and Get Microsoft Graph access token.
        /// </summary>
        /// <remarks>Need Sign in and read user profile scopes (User.Read)</remarks>
        /// <returns>Returns success or failure of login attempt.</returns>
        public virtual async Task <bool> LoginAsync(string loginHint = null)
        {
            IsConnected = false;
            if (!IsInitialized)
            {
                throw new InvalidOperationException("Microsoft Graph not initialized.");
            }

            Authentication = new MicrosoftGraphAuthenticationHelper(DelegatedPermissionScopes);
            string accessToken = null;

#if WINRT
            if (AuthenticationModel == AuthenticationModel.V1)
            {
                accessToken = await Authentication.GetUserTokenAsync(AppClientId);
            }
            else
            {
                accessToken = await Authentication.GetUserTokenV2Async(AppClientId, loginHint);
            }
#else
            accessToken = await Authentication.GetUserTokenV2Async(AppClientId, _uiParent, _redirectUri, loginHint);
#endif

            if (string.IsNullOrEmpty(accessToken))
            {
                return(IsConnected);
            }

            IsConnected = true;

#if WINRT
            User = new MicrosoftGraphUserService(GraphProvider);
#else
            User = new MicrosoftGraphUserService(GraphProvider, _photosService);
#endif

            if ((ServicesToInitialize & ServicesToInitialize.UserProfile) == ServicesToInitialize.UserProfile)
            {
                await GetUserAsyncProfile();
            }

            if ((ServicesToInitialize & ServicesToInitialize.Message) == ServicesToInitialize.Message)
            {
                User.InitializeMessage();
            }

            if ((ServicesToInitialize & ServicesToInitialize.Event) == ServicesToInitialize.Event)
            {
                User.InitializeEvent();
            }

            return(IsConnected);
        }
        /// <summary>
        /// Login the user from Azure AD and Get Microsoft Graph access token.
        /// </summary>
        /// <remarks>Need Sign in and read user profile scopes (User.Read)</remarks>
        /// <returns>Returns success or failure of login attempt.</returns>
        public virtual async Task <bool> LoginAsync()
        {
            IsConnected = false;
            if (!IsInitialized)
            {
                throw new InvalidOperationException("Microsoft Graph not initialized.");
            }

            Authentication = new MicrosoftGraphAuthenticationHelper(DelegatedPermissionScopes);
            string accessToken = await Authentication.GetUserTokenV2Async(AppClientId, _uiParent, _redirectUri);

            if (string.IsNullOrEmpty(accessToken))
            {
                return(IsConnected);
            }

            IsConnected = true;

            User = new MicrosoftGraphUserService(GraphProvider, _photosService);

            if ((ServicesToInitialize & Toolkit.Services.MicrosoftGraph.MicrosoftGraphEnums.ServicesToInitialize.UserProfile) == Toolkit.Services.MicrosoftGraph.MicrosoftGraphEnums.ServicesToInitialize.UserProfile)
            {
                await GetUserAsyncProfile();
            }

            if ((ServicesToInitialize & Toolkit.Services.MicrosoftGraph.MicrosoftGraphEnums.ServicesToInitialize.Message) == Toolkit.Services.MicrosoftGraph.MicrosoftGraphEnums.ServicesToInitialize.Message)
            {
                User.InitializeMessage();
            }

            if ((ServicesToInitialize & Toolkit.Services.MicrosoftGraph.MicrosoftGraphEnums.ServicesToInitialize.Event) == Toolkit.Services.MicrosoftGraph.MicrosoftGraphEnums.ServicesToInitialize.Event)
            {
                User.InitializeEvent();
            }

            return(IsConnected);
        }