That's how I recurse through property objects. I used to flatten like you are doing then iterate. Now I just put my operations in my recursion algorithm for speed sake. In your case you are doing O(2n) where if you put the operation in the recursive algorithm you will get just O(n). So if you have deep trees it will take twice as long.
If timing is an issue it might be quicker just to iterate on the top level and delete them and then recreate them from the type definition (which has the default values).