avoiding code duplication in publisher