rewrite to use after_commit callbacks, change events names, fix Activerecord ->  ActiveRecord