Refactoroed updateRecord