save state to storage