trying to update database without adding duplicate rows