public bool Close(IMachine coreMachine, bool prompt) { if (coreMachine == null) { return(false); } IPersistableMachine pm = coreMachine as IPersistableMachine; bool remove = pm == null; if (pm != null && pm.PersistantFilepath == null) { if (prompt) { ConfirmCloseEventArgs args = new ConfirmCloseEventArgs(String.Format("Are you sure you want to close the \"{0}\" machine without persisting it?", coreMachine.Name)); ConfirmClose?.Invoke(this, args); if (!args.Result) { return(false); } } remove = true; } if (remove) { _model.RemoveMachine(coreMachine); } coreMachine.Close(); return(true); }