class SimpleStateManager implements StateManager {

    @Override
    public Resource storeState(Model newState, String username) {
        State state = createState(newState, username, stateFactory);
        try (RepositoryConnection conn = repository.getConnection()) {
            conn.add(state.getModel());
            return state.getResource();
        }
    }

}