Pass connection context to transaction execution

My approach on/Targets #563.
So I will clean this up and then submit a follow-up PR to split the function.