Added stateManager and updated application accordingly

Added stateManager and tests
Updated the example application (loginController and app configuration) to use the state manager.