public Repository setAttribute(String name, String value, Session session) {
   if (value != null) {
     value = value.trim();
     if (value.length() == 0) {
       value = null;
     }
   }
   List<NvPair> list = getNvPairs();
   if (list == null) {
     list = new ArrayList<>();
     setNvPairs(list);
   }
   if (value == null) {
     Iterator<NvPair> it = list.iterator();
     while (it.hasNext()) {
       NvPair nv = it.next();
       if (nv.getName().equals(name)) {
         session.delete(nv);
         it.remove();
       }
     }
   } else {
     NvPair found = null;
     for (NvPair nv : list) {
       if (nv.getName().equals(name)) {
         found = nv;
         break;
       }
     }
     if (found == null) {
       found = new NvPair();
       found.setRepository(this);
       found.setName(name);
       list.add(found);
     }
     found.setPropValue(value);
     session.save(found);
   }
   return this;
 }