save state to client