Refactor find_relevant_topics and find_categories

This breaks down two private methods into smaller methods for
readability. This also moves logic into the Category model class.