/** Update rec_name locally as it is computed on the server side. */
 private void updateRecName(Model model) {
   if (model.hasAttribute("name")) {
     model.set("rec_name", model.get("name"));
   } else {
     for (String key : model.getAttributeNames()) {
       if (model.get(key) instanceof String) {
         model.set("rec_name", model.get(key));
         break;
       }
     }
   }
 }
 /** Replace a temporary id with a real one in data in the queue. */
 @SuppressWarnings("unchecked")
 public void updateTempId(int tempId, int realId) {
   for (Command cmd : this.queue) {
     // As tempId is unique, make it brutal
     Model data = cmd.getData();
     Integer tempIdInt = new Integer(tempId); // just for equality
     for (String key : data.getAttributeNames()) {
       Object val = data.get(key);
       if (tempIdInt.equals(val)) {
         data.set(key, realId);
       } else if (val instanceof List) {
         List ids = (List) data.get(key);
         for (int i = 0; i < ids.size(); i++) {
           if (tempIdInt.equals(ids.get(i))) {
             ids.remove(i);
             ids.add(i, realId);
           }
         }
       }
     }
   }
 }