throw new SimpleMessageException("A group already exists with this name.");
}
}
session.get().save(group);
// default is to create membership for the owner
GroupMembership groupMembership = new GroupMembership();
groupMembership.setUser(group.getOwner());
groupMembership.setUserGroup(group);
session.get().save(groupMembership);
} else {
// let's make sure that if we are changing the group name that
// the only group with this name (for the group owner) is this group
session.get().saveOrUpdate(group);