How do I add and edit child devices manually in a SmartApp

I would like to a show a couple of input text boxes and based up the input add child devices
The inputs would be the child device ID and its name.
Then I create a child device based on those inputs.

The problem I have created a dynamic page to collect the input. I am having 2 problems

  1. Once the input page is used, it retains values entered the first time - there seems to be no way of clearing it since settings is read-only
  2. If I want to show similar UI when editing how do I show a page with text inputs that have prepopulated values read from the underlying device that was created in step 1.

I have seen several virtual device examples where the device is created based on the input from a backend - the dash button app by @redloro is similar to what i am doing but in his app there is seems to be no way of deleting buttons, and if you delete the physical buttons the entries seem to stick around in the app. Any ides on how input values on a page can be collected and edited in this case?