#69666Refactor handling of last inserted id
Description
The code to handle retrieving & updating the last inserted id of a recond is duplicated multiple times in the same or slightly different form. Extract this into a helper method.
The code to handle retrieving & updating the last inserted id of a recond is duplicated multiple times in the same or slightly different form. Extract this into a helper method.