Started work on saving state when exiting dialogs and activities