I need a macro to add entities to submodels from a spreadsheet of model-name & entity-name pairs

I'm reading pairs of sub-model-name & entity-name from a spreadsheet, and want to add the entities to the submodel, and the relationships between them.

First I'm adding the entities to the sub-models as follows...

    For i = 2 To rowcount
        submdlName = ..<getting from spreadsheet row, works fine>
        eName = ..<getting from spreadsheet row, works fine>
        submdl = ..<find submdl, that works fine>


is the red line correct? The code above does seem to work ok. The entities do get added to the submodels

but I then need to add the relationships to the sub-model, which I can't figure out. I'm just guessing.

For Each submdl In mdl.SubModels If Not submdl.MainSubModel Then For Each eDisp In submdl.EntityDisplays ent = eDisp.ParentEntity For Each rel In ent.ParentRelationships
' determine if the parent entity of the relationship is also in the submodel eDisp = submdl.EntityDisplays.Item(rel.ParentEntity.ID) ??? If eDisp <> Null ??? Then submdl.RelationshipDisplays.Add(rel.ID) End If Next
Next End If Next
I couldn't find any sample macros to give clues, and I don't know where else to look for detailed help.