Update record logic