public EmbeddableDatabaseChanges(EmbeddableDocumentStore embeddableDocumentStore, Action onDispose, Func<string, Etag, string[], bool> tryResolveConflictByUsingRegisteredConflictListeners)
		{
			this.onDispose = onDispose;
			this.tryResolveConflictByUsingRegisteredConflictListeners = tryResolveConflictByUsingRegisteredConflictListeners;
			Task = new CompletedTask<IDatabaseChanges>(this);
			indexesObservable = new EmbeddableObservableWithTask<IndexChangeNotification>();
			documentsObservable = new EmbeddableObservableWithTask<DocumentChangeNotification>();
			bulkInsertObservable = new EmbeddableObservableWithTask<BulkInsertChangeNotification>();
			replicationConflictsObservable = new EmbeddableObservableWithTask<ReplicationConflictNotification>();

			embeddableDocumentStore.DocumentDatabase.TransportState.OnIndexChangeNotification += (o, notification) =>
				enqueuedActions.Add(() => indexesObservable.Notify(o, notification));
			embeddableDocumentStore.DocumentDatabase.TransportState.OnDocumentChangeNotification += (o, notification) =>
				 enqueuedActions.Add(() => documentsObservable.Notify(o, notification));
			embeddableDocumentStore.DocumentDatabase.TransportState.OnReplicationConflictNotification += (o, notification) =>
				 enqueuedActions.Add(() => replicationConflictsObservable.Notify(o, notification));
			embeddableDocumentStore.DocumentDatabase.TransportState.OnReplicationConflictNotification += TryResolveConflict;
			embeddableDocumentStore.DocumentDatabase.TransportState.OnBulkInsertChangeNotification += (o, notification) =>
			                                                                                          enqueuedActions.Add(() =>
			                                                                                          {
				                                                                                          bulkInsertObservable.Notify(o, notification);
																										  documentsObservable.Notify(o, notification);
			                                                                                          });

			enqueuedTask = System.Threading.Tasks.Task.Factory.StartNew(() =>
			{
				while (true)
				{
					var action = enqueuedActions.Take();
					if (action == null)
						return;
					action();
				}
			});
		}
		public EmbeddableDatabaseChanges(EmbeddableDocumentStore embeddableDocumentStore, Action onDispose)
		{
			this.onDispose = onDispose;
			Task = new CompletedTask<IDatabaseChanges>(this);
			indexesObservable = new EmbeddableObservableWithTask<IndexChangeNotification>();
			documentsObservable = new EmbeddableObservableWithTask<DocumentChangeNotification>();

			embeddableDocumentStore.DocumentDatabase.TransportState.OnIndexChangeNotification += (o, notification) => 
				enqueuedActions.Add(() => indexesObservable.Notify(o, notification));
			embeddableDocumentStore.DocumentDatabase.TransportState.OnDocumentChangeNotification += (o, notification) =>
				 enqueuedActions.Add(() => documentsObservable.Notify(o, notification));

			enqueuedTask = System.Threading.Tasks.Task.Factory.StartNew(() =>
			{
				while (true)
				{
					var action = enqueuedActions.Take();
					if (action == null)
						return;
					action();
				}
			});
		}