saving app state to local storage