code: public Object removeAttribute(String id, boolean restore) {
          Object value = removeAttribute(id);
          if (restore) {
              String historyAttribute = id + "history";
              Queue<Object> history = (Queue<Object>) getAttribute(historyAttribute);
              if (history != null && !history.isEmpty()) {
                  Object previous = history.remove();
                  setAttribute(id, previous);
              }
          }
          return value;
      }
docs: remove attribute and restore previous attribute value
  
  @param id
  attribute name
  @param restore
  restore previous attribute value
  @return attribute value