@Override public void removeModel(ModelId modelId) { try { ModelResource modelResource = getById(modelId); if (!modelResource.getReferencedBy().isEmpty()) { throw new ModelReferentialIntegrityException( "Cannot remove model because it is referenced by other model(s)", modelResource.getReferencedBy()); } Item item = session.getItem(modelId.getFullPath()); item.remove(); session.save(); } catch (RepositoryException e) { throw new FatalModelRepositoryException("Problem occured removing the model", e); } }