             deletes.append(index)
           }
         }
-
+        
         subject.next(ObservableArrayEvent(change: .beginBatchEditing, source: self))
         self.array = array
         subject.next(ObservableArrayEvent(change: .deletes(deletes), source: self))
         subject.next(ObservableArrayEvent(change: .inserts(inserts), source: self))
         subject.next(ObservableArrayEvent(change: .endBatchEditing, source: self))
-      } else {
-        self.array = array
-        subject.next(ObservableArrayEvent(change: .replace, source: self))
       }
-    }
-  }
-}
+    } else {
+      replace(with: array)
+    }
+  }
+}

        }
      }
    }

    // Backtrack to find out the diff
    var backtrack: [DiffStep<Element>] = []
    var i = xLen

      subject.next(ObservableArrayEvent(change: .endBatchEditing, source: self))
    }
  }
  
  /// Change the underlying value withouth notifying the observers.
  public func silentUpdate(_ update: (inout [Item]) -> Void) {
    lock.atomic {
