public EntityAttributeGroup addEntityAttributeGroup(EntityAttributeGroup entityAttributeGroup) throws ApplicationException { if (entityAttributeGroup == null || entityAttributeGroup.getEntity() == null || entityAttributeGroup.getEntityAttributes() == null) { throw new ApplicationException("This entity attribute group is invalid."); } if (entityAttributeGroup.getEntityAttributeGroupId() != null) { throw new ApplicationException( "This entity attribute group already exists so it can only be updated."); } try { entityDefinitionDao.addEntityAttributeGroup(entityAttributeGroup); return entityAttributeGroup; } catch (DaoException e) { throw new ApplicationException(e.getMessage()); } }