save and restore calendar state