trigger XinEventContactPileUp on Activity_History_Daily_Report__c (after insert, after update, after delete) { 
 | 
    List<String> conIds = new List<String>(); 
 | 
    List<Date> conDates = new List<Date>(); 
 | 
  
 | 
    if (Trigger.isDelete) { 
 | 
        for (Activity_History_Daily_Report__c ah : Trigger.old) { 
 | 
            if (ah.Date__c != null) { 
 | 
                conIds.add(ah.Contact__c); 
 | 
                conDates.add(ah.Date__c); 
 | 
            } 
 | 
        } 
 | 
    } else { 
 | 
        for (Activity_History_Daily_Report__c ah : Trigger.new) { 
 | 
            if (ah.Date__c != null) { 
 | 
                conIds.add(ah.Contact__c); 
 | 
                conDates.add(ah.Date__c); 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
     
 | 
    if (conIds.size() > 0) ControllerUtil.updateContactMonth(conIds, conDates); 
 | 
} 
 |