diff --git a/autosave_form.module b/autosave_form.module
index b340cd9..e71f16f 100644
--- a/autosave_form.module
+++ b/autosave_form.module
@@ -52,10 +52,10 @@ function autosave_form_form_alter(&$form, FormStateInterface $form_state, $form_
   // as e.g. it might be surprising for the user getting autosave on the entity
   // view, because e.g. a block is using an entity form.
   $route =  \Drupal::routeMatch()->getRouteObject();
-  if ($route && ($route_defaults = $route->getDefaults()) && isset($route_defaults['_entity_form'])) {
+  if ($route && ($route_defaults = $route->getDefaults()) && (isset($route_defaults['_entity_form']) || isset($route_defaults['_controller']))) {
     list($entity_type_id, $form_op) = explode('.', $route_defaults['_entity_form']);
     $entity = $form_object->getEntity();
-    if (($entity->getEntityTypeId() != $entity_type_id) || ($form_object->getOperation() != $form_op)) {
+    if ((($entity->getEntityTypeId() != $entity_type_id) || ($form_object->getOperation() != $form_op)) && !isset($route_defaults['_controller'])) {
       return;
     }
   }
@@ -100,3 +100,33 @@ function autosave_form_entity_update(EntityInterface $entity) {
     }
   }
 }
+
+/**
+ * Implements hook_entity_insert().
+ */
+function autosave_form_entity_insert(EntityInterface $entity) {
+  static $conflict_enabled;
+  static $autosave_entity_form_storage;
+  $uid = \Drupal::currentUser()->id();
+
+  if (!isset($autosave_entity_form_storage)) {
+    /** @var \Drupal\autosave_form\Storage\AutosaveEntityFormStorageInterface $autosave_entity_form_storage */
+    $autosave_entity_form_storage = \Drupal::service('autosave_form.entity_form_storage');
+  }
+
+  if (($conflict_enabled === FALSE) || (is_null($conflict_enabled) && !($conflict_enabled = \Drupal::moduleHandler()->moduleExists('conflict')))) {
+    // If conflict management is not available the autosaved entity states have
+    // to be removed when the entity is saved.
+    $autosave_entity_form_storage->purgeAutosavedEntityState($entity->getEntityTypeId(), 0, NULL, NULL, NULL, $uid);
+  }
+  else {
+    $entity_type = $entity->getEntityType();
+    if ($entity_type->hasHandlerClass('autosave_form') && ($class = $entity_type->getHandlerClass('autosave_form'))) {
+      // If conflict is enabled and the entity is saved then delete only the
+      // current autosave session of the current user.
+      if ($autosave_session_id = $class::getAutosaveSessionID($entity)) {
+        $autosave_entity_form_storage->purgeAutosavedEntityState($entity->getEntityTypeId(), $entity->id(), $autosave_session_id, NULL, NULL, $uid);
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/src/Form/AutosaveEntityFormHandler.php b/src/Form/AutosaveEntityFormHandler.php
index 7c8a73b..7016368 100644
--- a/src/Form/AutosaveEntityFormHandler.php
+++ b/src/Form/AutosaveEntityFormHandler.php
@@ -231,7 +231,7 @@ class AutosaveEntityFormHandler implements AutosaveEntityFormHandlerInterface, E
       $changed_form_value = isset($input['changed']) ? $input['changed'] : NULL;
       $entity->setChangedTime($changed_form_value ?: $changed_time);
 
-      if (!$this->conflictEnabled && ($unchanged = $this->entityStorage->loadUnchanged($entity->id())) && ($unchanged->getChangedTimeAcrossTranslations() > $entity->getChangedTimeAcrossTranslations())) {
+      if (!$this->conflictEnabled && ($unchanged = $this->entityStorage->loadUnchanged($this->getEntityIdOrZero($entity))) && ($unchanged->getChangedTimeAcrossTranslations() > $entity->getChangedTimeAcrossTranslations())) {
         $form_state->setTemporaryValue('autosave_form_last_autosave_timestamp', 'entity_saved_meanwhile');
         return FALSE;
       }
@@ -247,7 +247,7 @@ class AutosaveEntityFormHandler implements AutosaveEntityFormHandlerInterface, E
    */
   public function getLastAutosavedFormState(FormStateInterface $form_state, $autosave_form_session_id, $uid) {
     list($form_id, $entity) = $this->getFormIDandEntity($form_state);
-    return $this->autosaveEntityFormStorage->getFormState($form_id, $entity->getEntityTypeId(), $entity->id(), $entity->language()->getId(), $uid, $autosave_form_session_id);
+    return $this->autosaveEntityFormStorage->getFormState($form_id, $entity->getEntityTypeId(), $this->getEntityIdOrZero($entity), $entity->language()->getId(), $uid, $autosave_form_session_id);
   }
 
   /**
@@ -255,7 +255,7 @@ class AutosaveEntityFormHandler implements AutosaveEntityFormHandlerInterface, E
    */
   public function storeState(FormStateInterface $form_state, $autosave_form_session_id, $autosave_timestamp, $uid) {
     list($form_id, $entity) = $this->getFormIDandEntity($form_state);
-    $this->autosaveEntityFormStorage->storeEntityAndFormState($form_id, $autosave_form_session_id, $entity->getEntityTypeId(), $entity->id(), $entity->language()->getId(), $uid, $autosave_timestamp, $entity, $form_state);
+    $this->autosaveEntityFormStorage->storeEntityAndFormState($form_id, $autosave_form_session_id, $entity->getEntityTypeId(), $this->getEntityIdOrZero($entity), $entity->language()->getId(), $uid, $autosave_timestamp, $entity, $form_state);
   }
 
   /**
@@ -263,7 +263,7 @@ class AutosaveEntityFormHandler implements AutosaveEntityFormHandlerInterface, E
    */
   public function getLastAutosavedTimestamp(FormStateInterface $form_state, $uid) {
     list($form_id, $entity) = $this->getFormIDandEntity($form_state);
-    return $entity->isNew() ? NULL : $this->autosaveEntityFormStorage->getLastAutosavedStateTimestamp($form_id, $entity->getEntityTypeId(), $entity->id(), $entity->language()->getId(), $uid);
+    return $this->autosaveEntityFormStorage->getLastAutosavedStateTimestamp($form_id, $entity->getEntityTypeId(), $this->getEntityIdOrZero($entity), $entity->language()->getId(), $uid);
   }
 
   /**
@@ -271,7 +271,7 @@ class AutosaveEntityFormHandler implements AutosaveEntityFormHandlerInterface, E
    */
   public function purgeCurrentAutosavedState(FormStateInterface $form_state, $uid) {
     list($form_id, $entity) = $this->getFormIDandEntity($form_state);
-    $this->autosaveEntityFormStorage->purgeAutosavedEntityState($entity->getEntityTypeId(), $entity->id(), $this->getAutosaveFormSessionID($form_state), $form_id, $entity->language()->getId(), $uid);
+    $this->autosaveEntityFormStorage->purgeAutosavedEntityState($entity->getEntityTypeId(), $this->getEntityIdOrZero($entity), $this->getAutosaveFormSessionID($form_state), $form_id, $entity->language()->getId(), $uid);
   }
 
   /**
@@ -279,7 +279,7 @@ class AutosaveEntityFormHandler implements AutosaveEntityFormHandlerInterface, E
    */
   public function purgeAllAutosavedStates(FormStateInterface $form_state, $uid) {
     list($form_id, $entity) = $this->getFormIDandEntity($form_state);
-    $this->autosaveEntityFormStorage->purgeAutosavedEntityState($entity->getEntityTypeId(), $entity->id(), NULL, $form_id, $entity->language()->getId(), $uid);
+    $this->autosaveEntityFormStorage->purgeAutosavedEntityState($entity->getEntityTypeId(), $this->getEntityIdOrZero($entity), NULL, $form_id, $entity->language()->getId(), $uid);
   }
 
   /**
@@ -287,7 +287,7 @@ class AutosaveEntityFormHandler implements AutosaveEntityFormHandlerInterface, E
    */
   public function isAutosaveEnabled(FormStateInterface $form_state) {
     list($form_id, $entity) = $this->getFormIDandEntity($form_state);
-    $allowed = !$entity->isNew() && !$this->currentUser->isAnonymous();
+    $allowed = !$this->currentUser->isAnonymous();
     return $allowed;
   }
 
@@ -320,4 +320,19 @@ class AutosaveEntityFormHandler implements AutosaveEntityFormHandlerInterface, E
     return [$form_id, $entity];
   }
 
+  /**
+   * We use 0 for the values of a new entity.
+   *
+   * @param $entity
+   * @return int
+   */
+  protected function getEntityIdOrZero($entity) {
+    if ($entity->isNew()) {
+      return 0;
+    }
+    else {
+      return $entity->id();
+    }
+  }
+
 }
diff --git a/src/Form/AutosaveFormBuilder.php b/src/Form/AutosaveFormBuilder.php
index 0f3157d..360631f 100644
--- a/src/Form/AutosaveFormBuilder.php
+++ b/src/Form/AutosaveFormBuilder.php
@@ -170,7 +170,12 @@ class AutosaveFormBuilder extends FormBuilder {
       // Restore entity form.
       if ($form_object instanceof EntityFormInterface) {
         $entity = $form_object->getEntity();
-        $autosaved_state = $this->autosaveEntityFormStorage->getEntityAndFormState($form_id, $entity->getEntityTypeId(), $entity->id(), $entity->language()->getId(), $this->currentUser()->id(), NULL, $autosaved_timestamp);
+        if ($entity->isNew()) {
+          $entity_id = 0;
+        } else {
+          $entity_id = $entity->id();
+        }
+        $autosaved_state = $this->autosaveEntityFormStorage->getEntityAndFormState($form_id, $entity->getEntityTypeId(), $entity_id, $entity->language()->getId(), $this->currentUser()->id(), NULL, $autosaved_timestamp);
 
         if (is_null($autosaved_state)) {
           // @todo Cover the case that the autosaved state has been purged
diff --git a/src/Storage/AutosaveEntityFormDatabaseStorage.php b/src/Storage/AutosaveEntityFormDatabaseStorage.php
index 677b90b..f0729cb 100644
--- a/src/Storage/AutosaveEntityFormDatabaseStorage.php
+++ b/src/Storage/AutosaveEntityFormDatabaseStorage.php
@@ -194,8 +194,14 @@ class AutosaveEntityFormDatabaseStorage implements AutosaveEntityFormStorageInte
    */
   public function hasAutosavedStateForFormState(FormStateInterface $form_state, $uid) {
     $result = FALSE;
-    if (($form_object = $form_state->getFormObject()) && ($form_object instanceof EntityFormInterface) && ($entity = $form_object->getEntity()) && !$entity->isNew()) {
-      $result = $this->hasAutosavedState($form_object->getFormId(), $entity->getEntityTypeId(), $entity->id(), $entity->language()->getId(), $uid, $form_state->get('autosave_form_session_id'));
+
+    if (($form_object = $form_state->getFormObject()) && ($form_object instanceof EntityFormInterface) && ($entity = $form_object->getEntity())) {
+      if ($entity->isNew()) {
+        $entity_id = 0;
+      } else {
+        $entity_id = $entity->id();
+      }
+      $result = $this->hasAutosavedState($form_object->getFormId(), $entity->getEntityTypeId(), $entity_id, $entity->language()->getId(), $uid, $form_state->get('autosave_form_session_id'));
     }
     return $result;
   }
