public IObservable <IChangeSet <TObject, TKey> > Run() { return(Observable.Create <IChangeSet <TObject, TKey> >(observer => { var allData = new Cache <TObject, TKey>(); var filteredData = new ChangeAwareCache <TObject, TKey>(); Func <TObject, bool> predicate = t => false; var locker = new object(); var refresher = LatestPredicateObservable() .Synchronize(locker) .Select(p => { //set the local predicate predicate = p; //reapply filter using all data from the cache return filteredData.RefreshFilteredFrom(allData, predicate); }); var dataChanged = _source // .Finally(observer.OnCompleted) .Synchronize(locker) .Select(changes => { //maintain all data [required to re-apply filter] allData.Clone(changes); //maintain filtered data filteredData.FilterChanges(changes, predicate); //get latest changes return filteredData.CaptureChanges(); }); return refresher .Merge(dataChanged) .NotEmpty() .SubscribeSafe(observer); })); }