Do not check if List is empty
DML operations on empty lists are NOT consuming the transaction DML limits?
Did you know that:
DML operations on empty lists are NOT consuming the transaction DML limits?
Don't do this
List<Account> accountsToInsert = new List<Account>();
if (!accountsToInsert.isEmpty()) {
insert accountsToInsert;
}Do this
List<Account> accountsToInsert = new List<Account>();
insert accountsToInsert;

