CatalogEntry newParent = cm.loadCatalogEntry(newParentId);
// check first if this repo entry is already attached to this new parent
List<CatalogEntry> existingChildren = cm.getChildrenOf(newParent);
for (CatalogEntry existingChild : existingChildren) {
RepositoryEntry existingRepoEntry = existingChild.getRepositoryEntry();
if (existingRepoEntry != null && existingRepoEntry.equalsByPersistableKey(toBeAddedEntry)) {
showError("catalog.tree.add.already.exists", toBeAddedEntry.getDisplayname());
return;
}
}
// don't create entry right away, user must select submit button first