Create application livecycle controller and move the navigation logic there.