protected void save(Type entity) throws NotUpdatedException {
        try {
                if (entity.getId()== null){
                    entityManager.persist(entity);
                }else {
                    entityManager.merge(entity);
                }
            } catch (Exception exception) {
            throw new NotUpdatedException("Could not update entity.", exception);
        }
    }