private Entity upsert(EntityMapping entityMapping) {
   List<Entity> attributeMappingEntities =
       attributeMappingRepository.upsert(entityMapping.getAttributeMappings());
   Entity entityMappingEntity;
   if (entityMapping.getIdentifier() == null) {
     entityMapping.setIdentifier(idGenerator.generateId());
     entityMappingEntity = toEntityMappingEntity(entityMapping, attributeMappingEntities);
     dataService.add(entityMappingMetaData.getName(), entityMappingEntity);
   } else {
     entityMappingEntity = toEntityMappingEntity(entityMapping, attributeMappingEntities);
     dataService.update(entityMappingMetaData.getName(), entityMappingEntity);
   }
   return entityMappingEntity;
 }
 private void setProtocolActive(Protocol protocol, boolean active) {
   protocol.setActive(active);
   dataService.update(Protocol.ENTITY_NAME, protocol);
 }