Properly handle inserting already-present values