Save state in callback