I don’t use $dowork() or similar in my astrology app. I haven’t got anything on how to make dowork and do insert do the right thing. I imagine it’s like you are trying, you’d have to override those methods and put in something to grab the lastrowid as you are doing.