public bool CloseProject() { var shouldClose = true; if (_context.CurrentProject == null) { return(true); } if (_context.CurrentProject.HasChanged) { shouldClose = askForSaveProject(); } if (!shouldClose) { return(false); } _context.PublishEvent(new ProjectClosingEvent()); _serializationTask.CloseProject(); _context.PublishEvent(new ProjectClosedEvent()); return(true); }