Refactoring. A new solution for keeping the selected categories