class HibernateGroupDAO extends HibernatePersistentObjectDAO<Group> implements GroupDAO {

	@Override
	public boolean insert(Group group, long parentGroupId) {
		if (!checkStoringAspect())
			return false;

		boolean result = true;

		if (group == null)
			return false;

		try {
			saveOrUpdate(group);
			flush();

			if (parentGroupId != 0) {
				// Inherit ACLs from the parent group
				inheritACLs(group, parentGroupId);
			} else {
				fixGuestPermissions(group);
			}
		} catch (Throwable e) {
			log.error(e.getMessage(), e);
			result = false;
		}

		return result;
	}

	private  HibernateGroupDAO();

}