Changed createEvent param from rec to cx.
Improved transaction handling.