diff --git a/flag.module b/flag.module
index 8a9ca4d..9027718 100644
--- a/flag.module
+++ b/flag.module
@@ -12,13 +12,11 @@ define('FLAG_ADMIN_PATH_START', 3);
 
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\Entity\Entity\EntityViewDisplay;
-use Drupal\flag\Entity\Flag;
 use Drupal\node\NodeInterface;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
 use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\user\UserInterface;
-use Drupal\Core\Form\FormStateInterface;
 
 /**
  * Implements hook_help().
@@ -269,20 +267,12 @@ function flag_user_delete(UserInterface $account) {
  * Shared helper for user account cancellation or deletion.
  */
 function flag_user_account_removal(UserInterface $account) {
-  /** var \Drupal\flag\FlagServiceInterface $flag_service */
+  /** @var \Drupal\flag\FlagService $flag_service */
   $flag_service = \Drupal::service('flag');
-
   // Remove flags by this user.
-  $flaggings = $flag_service->getFlaggings(NULL, NULL, $account);
-  foreach ($flaggings as $flagging_id => $flagging) {
-    $flag_service->unflag($flagging->getFlag(), $flagging->getFlaggable(), $account);
-  }
-
+  $flag_service->unflagAll(NULL, $account);
   // Remove flags that have been done to this user.
-  $flaggings = $flag_service->getFlaggings(NULL, $account);
-  foreach ($flaggings as $flagging_id => $flagging) {
-    $flag_service->unflag($flagging->getFlag(), $flagging->getFlaggable());
-  }
+  $flag_service->unflagAll($account);
 }
 
 /**
diff --git a/src/FlagService.php b/src/FlagService.php
index 195568a..4db9c38 100644
--- a/src/FlagService.php
+++ b/src/FlagService.php
@@ -273,6 +273,25 @@ class FlagService implements FlagServiceInterface {
   /**
    * {@inheritdoc}
    */
+  public function unflagAll(EntityInterface $entity = NULL, AccountInterface $account = NULL) {
+    /** @var \Drupal\flag\FlagServiceInterface $flag_service */
+    $flag_service = \Drupal::service('flag');
+    $flaggings = $flag_service->getFlaggings(NULL, $entity, $account);
+
+    /** @var \Drupal\flag\FlaggingInterface $flagging */
+    foreach ($flaggings as $flagging_id => $flagging) {
+      if ($flaggable = $flagging->getFlaggable()) {
+        $flag_service->unflag($flagging->getFlag(), $flaggable, $account);
+      }
+      else {
+        $flagging->delete();
+      }
+    }
+  }
+
+  /**
+   * {@inheritdoc}
+   */
   public function reset(FlagInterface $flag, EntityInterface $entity = NULL) {
     $query = $this->entityQueryManager->get('flagging')
       ->condition('flag_id', $flag->id());
diff --git a/src/FlagServiceInterface.php b/src/FlagServiceInterface.php
index a6411f4..e18df28 100644
--- a/src/FlagServiceInterface.php
+++ b/src/FlagServiceInterface.php
@@ -151,16 +151,31 @@ interface FlagServiceInterface {
   public function unflag(FlagInterface $flag, EntityInterface $entity, AccountInterface $account = NULL);
 
   /**
+   * Unflag all flags given to an entity or by an account.
    *
+   * @param \Drupal\Core\Entity\EntityInterface|NULL $entity
+   *    Will remove all flags done to this entity.
+   * @param \Drupal\Core\Session\AccountInterface|NULL $account
+   *    Will remove all flags by this account.
+   *
+   * @see FlagServiceInterface::remove()
+   *    Not be confused with remove().
+   */
+  public function unflagAll(EntityInterface $entity = NULL, AccountInterface $account = NULL);
+
+  /**
    * Remove all flagged entities from a flag.
    *
    * @param FlagInterface $flag
-   *  The flag to reset.
+   *   The flag to reset.
    * @param EntityInterface $entity
-   *  (optional) The entity for which to delete flaggings.
+   *   (optional) The entity for which to delete flaggings.
    *
    * @return int
-   *  The number of flaggings that have been deleted.
+   *   The number of flaggings that have been deleted.
+   *
+   * @see FlagServiceInterface::unflagAll()
+   *    Not be confused with unflagAll().
    */
   public function reset(FlagInterface $flag, EntityInterface $entity = NULL);
 
diff --git a/src/Tests/FlagSimpleTest.php b/src/Tests/FlagSimpleTest.php
index 4d8c6cc..cd10205 100644
--- a/src/Tests/FlagSimpleTest.php
+++ b/src/Tests/FlagSimpleTest.php
@@ -7,9 +7,11 @@
 
 namespace Drupal\flag\Tests;
 
+use Drupal\node\NodeInterface;
 use Drupal\simpletest\WebTestBase;
 use Drupal\user\RoleInterface;
 use Drupal\user\Entity\Role;
+use Drupal\user\UserInterface;
 
 
 /**
@@ -181,7 +183,7 @@ class FlagSimpleTest extends WebTestBase {
 
     $this->drupalLogin($this->adminUser);
     $edit = [
-      'global' => true,
+      'global' => TRUE,
     ];
     $this->drupalPostForm('admin/structure/flags/manage/' . $this->id, $edit, t('Save Flag'));
     $this->drupalGet('admin/structure/flags/manage/' . $this->id);
@@ -193,7 +195,7 @@ class FlagSimpleTest extends WebTestBase {
 
     $this->drupalLogin($this->adminUser);
     $edit = [
-      'global' => false,
+      'global' => FALSE,
     ];
     $this->drupalPostForm('admin/structure/flags/manage/' . $this->id, $edit, t('Save Flag'));
     $this->drupalGet('admin/structure/flags/manage/' . $this->id);
@@ -245,36 +247,45 @@ class FlagSimpleTest extends WebTestBase {
   public function doUserDeletionTest() {
     $node = $this->drupalCreateNode(['type' => $this->nodeType]);
     $node_id = $node->id();
+    $node2 = $this->drupalCreateNode(['type' => $this->nodeType]);
 
     // Create and login a new user.
-    $user_1 = $this->drupalCreateUser();
+    $user_1 = $this->drupalCreateUser(['delete any article content']);
     $this->drupalLogin($user_1);
 
+    // Flag both nodes.
     $this->drupalGet('node/' . $node_id);
     $this->clickLink('Flag this item');
     $this->assertResponse(200);
     $this->assertLink('Unflag this item');
+    $this->drupalGet('node/' . $node2->id());
+    $this->clickLink('Flag this item');
+    $this->assertResponse(200);
 
-    $count_flags_before = \Drupal::entityQuery('flagging')
-      ->condition('uid', $user_1->id())
-      ->condition('flag_id', $this->id)
-      ->condition('entity_type', $node->getEntityTypeId())
-      ->condition('entity_id', $node_id)
-      ->count()
-      ->execute();
+    // Assert that the nodes are set to flagged.
+    $count_flags_before = $this->countFlagging($user_1, $node);
+    $this->assertEqual(1, $count_flags_before);
+    $count_flags_before = $this->countFlagging($user_1, $node2);
+    $this->assertEqual(1, $count_flags_before);
 
-    $this->assertTrue(1, $count_flags_before);
+    // Delete one node.
+    $this->drupalPostForm('node/' . $node2->id() . '/delete', [], t('Delete'));
+    $this->assertResponse(200);
 
-    $user_1->delete();
+    // Assert that both nodes remain as flagged after the changes.
+    // @todo This will fail when fixing this issue https://www.drupal.org/node/2551311
+    $count_flags_before = $this->countFlagging($user_1, $node);
+    $this->assertEqual(1, $count_flags_before);
+    $count_flags_before = $this->countFlagging($user_1, $node2);
+    $this->assertEqual(1, $count_flags_before);
 
-    $count_flags_after = \Drupal::entityQuery('flagging')
-      ->condition('uid', $user_1->id())
-      ->condition('flag_id', $this->id)
-      ->condition('entity_type', $node->getEntityTypeId())
-      ->condition('entity_id', $node_id)
-      ->count()
-      ->execute();
+    // Delete the user.
+    $user_1->delete();
 
+    // Ensure that all the flags are deleted.
+    $count_flags_after = $this->countFlagging($user_1, $node);
+    $this->assertEqual(0, $count_flags_after);
+    $count_flags_after = $this->countFlagging($user_1, $node2);
     $this->assertEqual(0, $count_flags_after);
   }
 
@@ -352,4 +363,27 @@ class FlagSimpleTest extends WebTestBase {
 
     $this->assertEqual(0, $count_flags_before);
   }
+
+  /**
+   * Count the number of flags of the user over an entity.
+   *
+   * @param UserInterface $user
+   *    The user owner of the flags.
+   * @param NodeInterface $node
+   *    The node flagged.
+   *
+   * @return int
+   *    Number of flags.
+   */
+  protected function countFlagging(UserInterface $user, NodeInterface $node) {
+    // Ensure there is still one flagged.
+    return \Drupal::entityQuery('flagging')
+      ->condition('uid', $user->id())
+      ->condition('flag_id', $this->id)
+      ->condition('entity_type', $node->getEntityTypeId())
+      ->condition('entity_id', $node->id())
+      ->count()
+      ->execute();
+  }
+
 }
