You should check to see how the patientDataSetEditor does this, and if it is able to handle this without saving the wrapped definitions.