class SimpleStateManager implements StateManager {

    @Override
    public Model getState(Resource stateId) {
        if (!stateExists(stateId)) {
            throw new IllegalArgumentException("State not found");
        }
        Model result = modelFactory.createModel();
        Model stateModel = modelFactory.createModel();
        try (RepositoryConnection conn = repository.getConnection()) {
            conn.getStatements(stateId, null, null).forEach(stateModel::add);
            stateModel.filter(stateId, factory.createIRI(State.stateResource_IRI), null).objects().forEach(value ->
                    conn.getStatements((Resource) value, null, null).forEach(result::add));
            return result;
        }
    }

}