Refactoring to share more code between channels and topics.