Hi,
This “Merge Components” python add-on does exactly that: https://forum.visualcomponents.com/t/merge-components/
-k