NSMutableDictionary<String, Object> relationshipPropertyList = new NSMutableDictionary<String, Object>();
relationship.encodeIntoPropertyList(relationshipPropertyList);
relationshipPropertyList.setObjectForKey(baseEntity.name(), "destination");
EORelationship primaryRelationship = new EORelationship(relationshipPropertyList, entity);
primaryRelationship.awakeWithPropertyList(relationshipPropertyList);
// MS: This looks silly, but 5.4 has a bug where the relationship dictionary isn't necessarily initialized at this point, so we want to force it to load
entity.relationshipNamed(relationship.name());
entity.removeRelationship(relationship);
entity.addRelationship(primaryRelationship);
}