 
         portal.url = null;
         portal.unload();
+    }
+
+    private function dispatchPortalStatusUpdate():void
+    {
+        updatePortalHandlersBasedOnStatus();
+        AppEvent.dispatch(AppEvent.PORTAL_STATUS_UPDATED);
+    }
+
+    private function updatePortalHandlersBasedOnStatus():void
+    {
+        if (portal.signedIn)
+        {
+            AppEvent.addListener(AppEvent.PORTAL_SIGN_OUT, portalSignOutHandler);
+            AppEvent.removeListener(AppEvent.PORTAL_SIGN_IN, portalSignInHandler);
+            IdentityManager.instance.removeEventListener(IdentityManagerEvent.SIGN_IN, identityManager_signInHandler);
+        }
+        else
+        {
+            AppEvent.addListener(AppEvent.PORTAL_SIGN_IN, portalSignInHandler);
+            IdentityManager.instance.addEventListener(IdentityManagerEvent.SIGN_IN, identityManager_signInHandler);
+            AppEvent.removeListener(AppEvent.PORTAL_SIGN_OUT, portalSignOutHandler);
+        }
     }
 
     private function portal_loadHandler(event:PortalEvent):void

        }
        else
        {
            AppEvent.dispatch(AppEvent.PORTAL_STATUS_UPDATED);
        }
    }
}

        portal.removeEventListener(PortalEvent.LOAD, portal_loadHandler);
        portal.removeEventListener(FaultEvent.FAULT, portal_faultHandler);

        dispatchPortalStatusUpdate();
    }

    private function portal_faultHandler(event:FaultEvent):void
