Changed insert to update-upsert, which will insert or ignore duplicated entries.