Refactor MacAppStore Generator code to remove duplication.