I have an array of 100 objects with category and subcategory properties and I want to create a new array with the name of each category and the number(count) of subcategories for that category?
Example of array:
[{
    ticketId: 1,
    Category: "Driver",
    CategoryID: 29,
    SubCategory: "Monitor",
    SubCategoryID: 31
}, {
    ticketId: 2,
    Category: "Driver",
    CategoryID: 29,
    SubCategory: "Monitor",
    SubCategoryID: 31
}, {
    ticketId: 3,
    Category: "Hardware",
    CategoryID: 11,
    SubCategory: "Monitor",
    SubCategoryID: 32
}, {
    ticketId: 4,
    Category: "Hardware",
    CategoryID: 11,
    SubCategory: "phone",
    SubCategoryID: 13
}];
Example of list of categories:
[{
    "ID": 1,
    "ParentID": 0,
    "Name": "Printing"
}, {
    "ID": 2,
    "ParentID": 1,
    "Name": "Toner"
}, {
    "ID": 3,
    "ParentID": 1,
    "Name": "Power"
}, {
    "ID": 4,
    "ParentID": 1,
    "Name": "Paper Jam"
}, {
    "ID": 5,
    "ParentID": 0,
    "Name": "Office Applications"
}]
Parent ID of 0 being the Category and any other number being the SubCategory