I get this error Cannot add an entity with a key that is already in use. when I run the code below.
Cannot add an entity with a key that is already in use.
Tables:
Seems you are missing primary key or an unique key on CMSPageObject table. Please try to verify the keys in the database. I had same issue since I had missed the PK on the table.
Cheers.