Found this by tracing through a unit test.
In order to duplicated you need a table structure similar to this: (this very simplified to my layout and the names have been changed to protect the innocent)
MetaEvent table
Meta-EventId
StartEventId
EndEventId
Event table
EventId
MetaEventId
Meta Event table combines events and links back to a start event and and end event. It could also include other events.
The EventTable has an Id of what MetaEvent it belongs to. Each Event may or may not be the StartEvent or the EndEvent.
you end up with an Event entity that has properties similar to
MetaEventCollectionGetByStartEventId
and
MetaEventCollectionGetByEndEventId
That was the setup - here is the bug...
as The Event entity goes through the DeepSave, it creates a Dictionary of Delegates called deepHandles
then it goes through each of the collection properties (such as the ones listed above) and adds the DeepSave method as the delegate with the MetaEvent.
Heres where the error happens. Since those two properties are the same type and could potentially have the Same object in them, the DeepHandles throws an error saying that the item has already been added.
To clarify.. i have a Event that is referenced as the StartEvent and the EndEvent for a single MetaEvent, which is what is causing the error.