Yes attributeEntity.SkinId is the fk.
There's a SkinEntity and it contains a collection of SkinAttributes.
Here's what happens.
A SkinEntity is fetched and its attributes are pre-fetched. The skin is bound to a web page and then discarded. The collection is bound to a webcontrol and is stored in session.
When a user submits the web page, the skin entity is re-created and I'm trying to plug the attributes back in. I can't directly assign because the skin's property is read only so I figure I have to copy them across one at a time.
If an attributes is new, then just adding it to the skin's attributes collection doesn't seem to be enough to set up the relationship. (I'd have thought it would be else why else is the attribute in the collection?) So instead I assign the new attribute's SkinID to the key for the webpage which identifies the skin.
From what you're saying this will make the attribute be removed fom the source collection. Well it would be helpful if it wasn't.