/***********************************************************************************************************
 * Name         : TriggerUtils
 * Purpose      : Common Trigger methods
 **********************************************************************************************************/
public with sharing class TriggerUtils {
    /**
     * @description Checks whether the specified field is changing in the current Trigger context
     * @param oldRecord old SObject record
     * @param newRecord new SOBject record
     * @param field     the field to check
     * @return Boolean  true if the field has changed
     */
    public static Boolean fieldHasChanged(SObject oldRecord, SObject newRecord, String field) {
        return (oldRecord == null && newRecord.get(field) != null) ||
            (oldRecord != null &&
            oldRecord.get(field) != newRecord.get(field));
    }
}