Save state between sessions.