code: func restUpdateDevice(w http.ResponseWriter, r *http.Request) {
  	defer r.Body.Close()
  	var rd models.Device
  	err := json.NewDecoder(r.Body).Decode(&rd)
  	if err != nil {
  		LoggingClient.Error(err.Error())
  		http.Error(w, err.Error(), http.StatusServiceUnavailable)
  		return
  	}
  
  	// Check if the device exists
  	// First try ID
  	oldDevice, err := dbClient.GetDeviceById(rd.Id)
  	if err != nil {
  		// Then try name
  		oldDevice, err = dbClient.GetDeviceByName(rd.Name)
  		if err != nil {
  			LoggingClient.Error(err.Error())
  			http.Error(w, err.Error(), http.StatusNotFound)
  			return
  		}
  	}
  
  	if err = updateDeviceFields(rd, &oldDevice); err != nil {
  		LoggingClient.Error(err.Error())
  		http.Error(w, err.Error(), http.StatusServiceUnavailable)
  		return
  	}
  
  	if err = dbClient.UpdateDevice(oldDevice); err != nil {
  		LoggingClient.Error(err.Error())
  		http.Error(w, err.Error(), http.StatusServiceUnavailable)
  		return
  	}
  
  	ctx := r.Context()
  	// Notify
  	notifyDeviceAssociates(oldDevice, http.MethodPut, ctx)
  
  	w.WriteHeader(http.StatusOK)
  	w.Write([]byte("true"))
  }
docs: // Update the device
  // Use ID to identify device first, then name
  // Can't create new Device Services/Profiles with a PUT, but you can reference another one