I agree with @jiminybillybob.
Real-world workflow situations frequently motivate the need to convert selected components to groups. While keeping components’ all relevant definition and instance properties intact. And being applicable in batch.
Well – have a look at @eneroth3 's fairly recent extension Eneroth Component to Group which includes source code as plain text and a dedicated forum thread.
Perhaps it can help.