What Brian says is absolutely right.
I didn't think of this case (when you save the same value) on updating the record. In this case it will fail, as the value is already in the database.
Your case is similar as this, so the solution will be the same: