code: public void remove(String tangoHost) throws DevFailed {
  
          //  Remove device and class in reverse order,
  		//	to remove the DServer as last one.
          //  If a failure append during this method,
          //	the server will be able to reloaded.
          Database    database = ApiUtil.get_db_obj(tangoHost);
          for (int i=classes.size()-1 ; i>=0 ; i--) {
              for (TangoDevice device : classes.get(i)) {
                  database.delete_device(device.name);
              }
          }
  
          //  Check if there is other instance(s) of classes
          for (TangoClass clazz : classes) {
              if (!clazz.name.toLowerCase().equals("dserver")) { //   NOT for DServer class
                  String[]    deviceNames = database.get_device_name("*", clazz.name);
                  if (deviceNames.length==0) {
                      //  There is no device any more --> remove class properties
                      clazz.removeProperties(database);
                      //System.out.println("Class properties removed for " + clazz.name);
                  }
                  else {
                      //System.out.println(clazz.name + " class is used. do not delete Class properties");
                  }
              }
          }
      }
docs: ===============================================================