class RdfEngine implements Engine {

    @Override
    public Optional<Group> retrieveGroup(String groupTitle) {
        try (RepositoryConnection conn = repository.getConnection()) {
            Optional<Resource> optId = getGroupId(groupTitle, conn);
            if (!optId.isPresent()) {
                return Optional.empty();
            }

            Model groupModel = mf.createModel();
            RepositoryResult<Statement> statements = conn.getStatements(optId.get(), null, null, context);
            statements.forEach(groupModel::add);
            roles.stream()
                    .map(this::getRole)
                    .forEach(roleOptional -> roleOptional.ifPresent(role -> groupModel.addAll(role.getModel())));
            groupModel.filter(optId.get(), vf.createIRI(Group.member_IRI), null)
                    .objects().forEach(userIRI -> {
                        RepositoryResult<Statement> userStatements = conn.getStatements((Resource) userIRI, null, null,
                                context);
                        userStatements.forEach(groupModel::add);
                    });
            return groupFactory.getExisting(optId.get(), groupModel);
        }
    }

}