private void OnExit(object sender, ExitEventArgs e) { if (_model.State.HasDiff(_state)) { var stateProvider = new StateProvider(); stateProvider.Save(_model.State); } }