private static void SubscribeImage(string imageUrl, IObserver <MemoryStream> observer, IDictionary <string, string> parameters = null, IProgress <Tuple <long, long> > progress = null) { var subscriptionKey = Guid.NewGuid(); var observable = ReactiveClient.GetImage(imageUrl, parameters, progress); var disposal = observable.Finally(() => CleanupSubscription(subscriptionKey)).Subscribe(observer); lock (SyncRoot) { CurrentSubscriptions.Add(subscriptionKey, disposal); } }