Refactor Category into ActiveRecord
Refactor search method to use ActiveRecord scope.