propetyBuilder.log.debug("Saved society " + configComponent.getShortName());
propertyBuilder.log.debug("Saved society " + configComponent.getShortName());
  private void saveToDatabase(boolean silently) {    if (experiment != null) {      saveExperiment();      return;    }    if (configComponent instanceof SocietyComponent) {      if (((SocietyComponent)configComponent).isModified()) {	final PropertyBuilder propertyBuilder = this;	GUIUtils.timeConsumingTaskStart(this);	GUIUtils.timeConsumingTaskStart(csmart);	try {	  new Thread("SaveSociety") {	    public void run() {	      boolean success = ((SocietyComponent)configComponent).saveToDatabase();	      GUIUtils.timeConsumingTaskEnd(propertyBuilder);	      GUIUtils.timeConsumingTaskEnd(csmart);	      if (!success && propertyBuilder.log.isWarnEnabled()) {		propertyBuilder.log.warn("Failed to save society " + configComponent.getShortName());	      } else if (propertyBuilder.log.isDebugEnabled()) {		propetyBuilder.log.debug("Saved society " + configComponent.getShortName());	      }	    }	  }.start();	} catch (RuntimeException re) {	  if(log.isErrorEnabled()) {	    log.error("Runtime exception saving society", re);	  }	  GUIUtils.timeConsumingTaskEnd(propertyBuilder);	  GUIUtils.timeConsumingTaskEnd(csmart);	}	//((SocietyComponent)configComponent).saveToDatabase();	CSMART.getOrganizer().displayExperiments((SocietyComponent)configComponent);      } else {	// If we opened a "local" version of a society within an experiment,	// then we want to remove this SocietyComponent from the workspace      }    } else if (configComponent instanceof RecipeComponent) {      try {        RecipeComponent rc = (RecipeComponent) configComponent;        PDbBase pdb = new PDbBase();        switch (pdb.recipeExists(rc)) {        case PDbBase.RECIPE_STATUS_EXISTS:          if (silently)            return; // don't need to save, don't say anything          JOptionPane.showMessageDialog(this,                                        "The recipe is already in the database with the same values.",                                        "Write Not Needed",                                        JOptionPane.INFORMATION_MESSAGE);          return;        case PDbBase.RECIPE_STATUS_DIFFERS:          // save the recipe, so workspace is consistent with database          break;        case PDbBase.RECIPE_STATUS_ABSENT:          break;                // Just write it        }        rc.saveToDatabase();        if (!silently)          JOptionPane.showMessageDialog(this,                                        "Recipe written successfully.",                                        "Recipe Written",                                        JOptionPane.INFORMATION_MESSAGE);        CSMART.getOrganizer().displayExperiments(rc);      } catch (Exception sqle) {        if(log.isErrorEnabled()) {          log.error("Exception", sqle);        }        JOptionPane.showMessageDialog(this,                                      "An exception occurred writing the recipe to the database",                                      "Error Writing Database",                                      JOptionPane.ERROR_MESSAGE);      }    }  }