Refactor recordEvents to separate userEvents and roleEvents