public static async Task <bool> IsGroupMember(this IArangoDatabase database, string userId, string groupId) { if (groupId == null || userId == null) { return(false); } var group = await database.Collection("Group").DocumentAsync <Group>(groupId); if (group == null) { return(false); } var isMember = await database.CreateStatement <bool>( $@"return (FOR v in 1 INBOUND 'Group/{groupId}' Graph 'GroupUsersGraph' FILTER v._key == '{userId}' return v) != []").ToListAsync(); return(isMember.FirstOr(false) || await database.IsAdmin(userId, groupId)); }