Deduplicate ChangesetEvents per Changeset before DB insert
Created by: mrnugget
This fixes #10264 by deduplicating the events per changeset before trying to insert them into the database.
Our unique-index on changsetID-kind-key ensures that we can update the same changeset event if we try to insert it a second time, but it breaks if we try to insert the same combination in the same query.
Since we shouldn't (see ticket!) have changesetevents with duplicate Kind+Key+ChangesetID in the first place, it's okay to drop them if we have them.