Implement shouldPublish, beforePublish and afterPublish