private async void InitializeUserInfo()
        {
            bool online = await SoftwareUserSession.IsOnlineAsync();

            bool softwareSessionFileExists = SoftwareCoUtil.softwareSessionFileExists();
            bool jwtExists       = SoftwareCoUtil.jwtExists();
            bool initializedUser = false;

            if (!softwareSessionFileExists || !jwtExists)
            {
                string result = await SoftwareUserSession.CreateAnonymousUserAsync(online);

                if (result != null)
                {
                    initializedUser = true;
                }
            }

            SoftwareUserSession.UserStatus status = await SoftwareUserSession.GetUserStatusAsync(true);

            SoftwareLoginCommand.UpdateEnabledState(status);

            if (initializedUser)
            {
                LaunchLoginPrompt();
            }

            if (online)
            {
                fetchSessionSummaryInfoAsync();

                // send heartbeat
                SoftwareUserSession.SendHeartbeat("INITIALIZED");
            }
        }
        public static async Task <UserStatus> GetUserStatusAsync(bool isInitialCall)
        {
            bool online = await IsOnlineAsync();

            bool softwareSessionFileExists = SoftwareCoUtil.softwareSessionFileExists();
            bool jwtExists = SoftwareCoUtil.jwtExists();

            if (!isInitialCall && isOnline && !jwtExists)
            {
                await SoftwareUserSession.CreateAnonymousUserAsync(online);
            }

            bool loggedIn = await IsLoggedOn(online);

            UserStatus currentUserStatus = new UserStatus();

            currentUserStatus.loggedIn = loggedIn;

            if (online && loggedInCacheState != loggedIn)
            {
                // change in logged in state, send heatbeat and fetch kpm
                SendHeartbeat("STATE_CHANGE:LOGGED_IN:" + loggedIn);

                try
                {
                    Thread.Sleep(1000);
                    SoftwareCoPackage.fetchSessionSummaryInfoAsync();
                }
                catch (ThreadInterruptedException e)
                {
                    //
                }
            }

            loggedInCacheState = loggedIn;

            SoftwareLaunchCommand.UpdateEnabledState(currentUserStatus);
            SoftwareLoginCommand.UpdateEnabledState(currentUserStatus);

            return(currentUserStatus);
        }