We can't help you here: we don't have access to your system, your code, or your data.
So start by looking at the error message:
An item with the same key has already been added.
That's a pretty obvious problem: your code is trying to insert a row with a value that matches an existing value but the column is marked as being unique.
There could be a huge number of reasons for this: from "getting the next value" in advance and assuming you can use that in a multiuser system, to doing an INSERT operation when you should be doing an UPDATE.
We can't tell. So start with the debugger, and look at the code that generates the error. Look at the data it is using, and look in your DB as well. Then try to see what value it complains about, and why you are trying to create a duplicate.
Sorry, but we can't do any of that for you!