         AppEvent.addListener(AppEvent.SETTINGS_SAVED, settingsChangeHandler);
     }
 
-    private function identityManager_signInHandler(event:IdentityManagerEvent):void
-    {
-        if (PortalModel.getInstance().hasSameOrigin(event.credential.server)
-            && !PortalModel.getInstance().portal.signedIn)
-        {
-            signIntoPortalInternally();
-        }
-    }
-
-    private function portalSignOutHandler(event:AppEvent):void
-    {
-        if (Log.isInfo())
-        {
-            LOG.info("Portal sign out requested");
-        }
-
-        IdentityManager.instance.removeEventListener(IdentityManagerEvent.SIGN_IN, identityManager_signInHandler);
-        portal.addEventListener(PortalEvent.LOAD, portal_loadHandler);
-        portal.addEventListener(FaultEvent.FAULT, portal_faultHandler);
-        portal.signOut();
-    }
-
-    private function portalSignInHandler(event:AppEvent):void
-    {
-        if (Log.isInfo())
-        {
-            LOG.info("Portal sign in requested");
-        }
-
-        signIntoPortalInternally();
-    }
-
-    private function signIntoPortalInternally():void
-    {
-        IdentityManager.instance.removeEventListener(IdentityManagerEvent.SIGN_IN, identityManager_signInHandler);
-        portal.addEventListener(PortalEvent.LOAD, portal_loadHandler);
-        portal.addEventListener(FaultEvent.FAULT, portal_faultHandler);
-        portal.signIn();
-    }
-
     private function settingsChangeHandler(event:AppEvent):void
     {
         //optimization: AGO uses OAuth, so we register the OAuth info upfront

            dispatchPortalStatusUpdate();
        }
    }
}
}

        }
    }

    private function identityManager_signInHandler(event:IdentityManagerEvent):void
    {
        if (PortalModel.getInstance().hasSameOrigin(event.credential.server)
            && !PortalModel.getInstance().portal.signedIn)
        {
            signIntoPortalInternally();
        }
    }

    private function signIntoPortalInternally():void
    {
        IdentityManager.instance.removeEventListener(IdentityManagerEvent.SIGN_IN, identityManager_signInHandler);
        portal.addEventListener(PortalEvent.LOAD, portal_loadHandler);
        portal.addEventListener(FaultEvent.FAULT, portal_faultHandler);
        portal.signIn();
    }

    private function portal_loadHandler(event:PortalEvent):void
