Apex trigger to count child records based on parent object in Salesforce