diff --git a/includes/entity.controller.inc b/includes/entity.controller.inc
index 2f87010..7495f1d 100644
--- a/includes/entity.controller.inc
+++ b/includes/entity.controller.inc
@@ -359,7 +359,6 @@ class EntityAPIController extends DrupalDefaultEntityController implements Entit
       rules_invoke_event($this->entityType . '_' . $hook, $entity);
     }
   }
-
   /**
    * Implements EntityAPIControllerInterface.
    *
@@ -379,6 +378,10 @@ class EntityAPIController extends DrupalDefaultEntityController implements Entit
     // $transaction = isset($transaction) ? $transaction : db_transaction();
 
     try {
+      foreach ($entities as $id => $entity) {
+        $this->invoke('delete', $entity);
+      }
+
       $ids = array_keys($entities);
 
       db_delete($this->entityInfo['base table'])
@@ -393,9 +396,7 @@ class EntityAPIController extends DrupalDefaultEntityController implements Entit
       // Reset the cache as soon as the changes have been applied.
       $this->resetCache($ids);
 
-      foreach ($entities as $id => $entity) {
-        $this->invoke('delete', $entity);
-      }
+
       // Ignore slave server temporarily.
       db_ignore_slave();
     }
