Link groups automaticaly using dynamo

Hello guys,

I currently have a couple of revit projects filled with a couple hundreds of model groups, but these libraryprojects are starting to get way too big for our aplications.
Does anyone have an idea of how to automaticaly link groups from model groups?

I have managed to get individual elements from linked groups, but creating the links one by one is a lot of work.

Thanks in advance, Johannes