this.saveRegMetadata(regMetadata);
} else {
this.updateRegMetadata(regMetadata);
}
//save the licence:
LicenceBean licenceBean = mdRegistrationBean.getLicenceBean();
Licence licence = copyLicenceBeanToLicence(licenceBean);
licence.setRegMetadata(regMetadata);
if (licence.getId() == 0) {
Licence existedLicence = this.getLicenceByRegMetadataId(regMetadata.getId());
if (existedLicence != null) {