simplify the code in updateRecord()