removeRuntimeAssembly(csmiAssemblyId); if (! isAssemblyUsed(csmiAssemblyId)) cleanAssembly(csmiAssemblyId);
cleanAssembly(csmiAssemblyId, true);
  public boolean populateCSA(ComponentData data)    throws SQLException  {    // For storing the old cmtAssid if we have to change it    String oldid = null;    // If this is saving an Experiment, we create a CSA assembly:    if (exptId != null && trialId != null) {      if (log.isDebugEnabled()) {	log.debug("populateCSA creating new soc def CSA for trial " + trialId);      }      // reset the flag noticing that something was modified while saving      componentWasRemoved = false;      // Create a new CSA based on what was in cmtAssemblyID      csaAssemblyId = createCSAAssembly(cmtAssemblyId, getAssemblyDesc(cmtAssemblyId));            // Delete any existing CSA / CMT in runtime for this experiment, completely if necc      cleanOldRuntimeSocietyAssemblies();      // Must also delete any CSMI assembly that exists so far. We won't be using one.      if (csmiAssemblyId != null) {	removeRuntimeAssembly(csmiAssemblyId);	if (! isAssemblyUsed(csmiAssemblyId))	  cleanAssembly(csmiAssemblyId);	// FIXME: Do I need to create a new one?	csmiAssemblyId = null;      }      // FIXME: What if a recipe modified the Agents in use? Must I      // remove the CSHNA assembly as well?            // Add this new assembly to the runtime assemblies for this experiment      substitutions.put(":assembly_type:", csaType);      addAssemblyToRuntime(csaAssemblyId);      // For purposes of populate, this is the society definition      cmtAssemblyId = csaAssemblyId;      setAssemblyMatch();    } // End of case where this is an Experiment    if (log.isDebugEnabled()) {      log.debug("populateCSA saving into " + cmtAssemblyId);    }    //     componentArgs.clear();    //Save the full given tree into a CSA assembly, which should already    // exist. Someone else must put the entry for this assembly    // in the runtime or config time places, as necessary    boolean result = populate(data, 1f, cmtAssemblyId);    // Restore the original cmtAssid if necc, for use by fixAssemblies    if (oldid != null)      cmtAssemblyId = oldid;    return result;  }