boolean entityExists = false;
validateNotSigned(businessEntity);
String entityKey = businessEntity.getBusinessKey();
if (entityKey == null || entityKey.length() == 0) {
KeyGenerator keyGen = KeyGeneratorFactory.getKeyGenerator();
entityKey = keyGen.generate();
businessEntity.setBusinessKey(entityKey);
} else {
// Per section 4.4: keys must be case-folded
entityKey = entityKey.toLowerCase();
businessEntity.setBusinessKey(entityKey);