Update publishEvents method.