Refactor publish to it's own method