class SimpleStateManager implements StateManager {

    @Override
    public void deleteState(Resource stateId) {
        if (!stateExists(stateId)) {
            throw new IllegalArgumentException("State not found");
        }
        try (RepositoryConnection conn = repository.getConnection()) {
            Model stateModel = modelFactory.createModel();
            conn.getStatements(stateId, null, null).forEach(stateModel::add);
            stateFactory.getExisting(stateId, stateModel).ifPresent(state -> removeState(state, conn));
        }
    }

}