refactor: simplify mysql event recording by factoring out common code

still not enabled