Merge xrefs, change color geometry and convert back to xref

Hi,

I'm looking to merge some xrefs by their selected parent dummies. Merge them into the scene, change their wireframe color and convert them back into an xref at the same file-path with the same name and attached to the same parent dummy as before they got merged, to eventually add them back into the scene again.

Is this possible? looking at some of the syntaxes I believe so but not sure how to make it work.

Hope you have a solution for me :)

Kind regards,
Remy