public void save() throws RegistryException {
EntityManager em = null;
try {
em = ResourceUtils.getEntityManager();
Experiment_Output existingOutput = em.find(Experiment_Output.class, new Experiment_Output_PK(experimentResource.getExpID(), experimentKey));
em.close();
em = ResourceUtils.getEntityManager();
em.getTransaction().begin();
Experiment_Output exOutput = new Experiment_Output();
exOutput.setEx_key(experimentKey);
Experiment experiment = em.find(Experiment.class, experimentResource.getExpID());
exOutput.setExperiment(experiment);
exOutput.setExperiment_id(experiment.getExpId());
exOutput.setValue(value);
exOutput.setOutputKeyType(outputType);
exOutput.setMetadata(metadata);
if (existingOutput != null) {
existingOutput.setEx_key(experimentKey);
existingOutput.setExperiment(experiment);
existingOutput.setValue(value);