Insert or update new entry to avoid duplicates when updating