added logic to filter categories based on selected department