if (!isExperimentExists(experimentId, true)){
throw new ExperimentDoesNotExistsException(experimentId);
}
ExperimentResource experiment = jpa.getWorker().getExperiment(experimentId);
ExperimentDataResource data = experiment.getData();
ExperimentMetadataResource experimentMetadata;
if (data.isExperimentMetadataPresent()){
experimentMetadata = data.getExperimentMetadata();
experimentMetadata.setMetadata(metadata);
}else{
experimentMetadata = data.createExperimentMetadata();
experimentMetadata.setMetadata(metadata);
}
experimentMetadata.save();
}
}