public BusinessGroup findGroupAttendedBy(Identity identity, String groupName, BGContext bgContext) {
String query = "select bgi from " + " org.olat.group.BusinessGroupImpl as bgi "
+ ", org.olat.basesecurity.SecurityGroupMembershipImpl as sgmi" + " where bgi.name = :name "
+ " and bgi.partipiciantGroup = sgmi.securityGroup" + " and sgmi.identity = :identId" + " and bgi.groupContext = :context";
DB db = DBFactory.getInstance();
DBQuery dbq = db.createQuery(query);
dbq.setEntity("identId", identity);
dbq.setString("name", groupName);
dbq.setEntity("context", bgContext);
List res = dbq.list();
if (res.size() == 0) return null;