Prevent Apex Trigger To Run Twice

Provide a static variable to check if trigger has already been called and prevent it to be called twice. In this case the static variable is called firstRun.

trigger AccountTrigger on Account (after delete, after insert, after undelete, after update, before delete, before insert, before update) {
    if (!System.isFuture() && !System.isBatch())
    {
      AccountTriggerHandler handler = new AccountTriggerHandler(Trigger.isExecuting, Trigger.size);

      if(Trigger.isUpdate && Trigger.isBefore){
        if(AccountTriggerHandler.firstRun){
          handler.OnBeforeUpdate(Trigger.old, Trigger.new, Trigger.newMap);
          AccountTriggerHandler.firstRun=false;
        }
      }
      else if(Trigger.isUpdate && Trigger.isAfter){
        handler.OnAfterUpdate(Trigger.old, Trigger.new, Trigger.newMap);
      }
      else if(Trigger.isDelete && Trigger.isBefore){
        handler.OnBeforeDelete(Trigger.old, Trigger.oldMap);
      }
    }
}
public with sharing class AccountTriggerHandler {
	
 	public static boolean firstRun = true; 

	private Boolean m_isExecuting = false;
    private Integer batchSize = 0;

	public AccountTriggerHandler(boolean isExecuting, integer size) {
		this.m_isExecuting = isExecuting;
        this.batchSize = size;
	}

	public void onBeforeUpdate(List<Account> oldAccounts, List<Account> updatedAccounts, Map<Id, Account> accountMap){
		AccountUpdateActorId accountActorId = new AccountUpdateActorId();
		accountActorId.updateAccountId(oldAccounts, updatedAccounts, accountMap);
 		
 		AccountSendEmailWhenOwnerChanges accountOwnerChangeNotification = new AccountSendEmailWhenOwnerChanges();
		accountOwnerChangeNotification.checkOwnerAndSendEmail(oldAccounts, updatedAccounts, accountMap);
	}
	public void OnAfterUpdate(List<Account> oldAccounts, List<Account> updatedAccounts, Map<Id, Account> accountMap){
		UpdateHouseHoldReference houseReference = new UpdateHouseHoldReference();
		houseReference.updateAccountHouseholdReference(oldAccounts, updatedAccounts, accountMap);
	}
	
	public void OnBeforeDelete(List<Account> deletedAccounts, Map<ID, Account> accountMap){
		ChangeAMIDAccountReferenceOnMerge changeAMIDAccounReference = new ChangeAMIDAccountReferenceOnMerge();
		changeAMIDAccounReference.changeAMIDAccountReferenceBeforeDelete(deletedAccounts, accountMap);
	}
}

Apex Trigger Before Update Before Insert Example

trigger addSalesRepToLCR on LawyerConnectionRequest__c (before insert, before update) 
{       
    if (Trigger.isUpdate || Trigger.isInsert)
    {
        Set<Id> contactIds = new Set<Id>();
        for (LawyerConnectionRequest__c lcrToGetContactIds : Trigger.New)
        {
            contactIds.add(lcrToGetContactIds.Client__c);
        }

        Map<Id, Contact> mapOfUsers = new Map<Id, Contact>([select Id, Owner.Id, Owner.Profile.Name from Contact where Id In :contactIds]);
        for (LawyerConnectionRequest__c lcr : Trigger.New)
        {
            if (lcr.Client__c != null)
            {
                Contact newUser = mapOfUsers.get(lcr.Client__c);
                if (newUser.Owner.Profile.Name == 'Rocket Lawyer Sales')
                {
                    lcr.Sales_Rep__c = newUser.Owner.Id;
                }
            }
        }       
    }
}