update record function