Group newGroup = null;
try {
Group existingGroup = getGroup(name);
//The group already exists since now exception, so:
throw new GroupAlreadyExistsException();
} catch (GroupNotFoundException unfe) {
//The group doesn't already exist so we can create a new group
newGroup = new DbGroup(name, factory);
}
return newGroup;