Using same transaction during update

I think I may have figured it out. The problem is that my code which is executing the command is creating a fresh service instance which has its own transaction.

What I need to do is make this service instance use the same transaction as the existing instance being used by the update process.

I did something very similar a while ago here: Wrapping multiple client calls in a transaction

I have access to the service via the Sender.Service in the BeforeProcessChange handler so I should be able to pass this to my command execution code and make it use that. I’ll give it a go.