Inheritance: IWoopsaNotifications
        private int RetrieveNotification(out WoopsaClientNotifications notificationsResult, int lastNotificationId)
        {
            WoopsaJsonData results = WaitNotification(_subscriptionOpenChannel.Value, lastNotificationId);

            var notificationsList = new WoopsaClientNotifications();

            int count = 0;
            for (int i = 0; i < results.Length; i++)
            {
                WoopsaJsonData notification = results[i];
                var notificationValue = notification["Value"];
                var notificationSubscriptionId = notification["SubscriptionId"];
                var notificationId = notification["Id"];
                WoopsaValueType type = (WoopsaValueType)Enum.Parse(typeof(WoopsaValueType), notificationValue["Type"]);
                WoopsaValue value = WoopsaValue.CreateChecked(notificationValue["Value"], type, DateTime.Parse(notificationValue["TimeStamp"]));
                WoopsaClientNotification newNotification = new WoopsaClientNotification(value, notificationSubscriptionId);
                newNotification.Id = notificationId;
                notificationsList.Add(newNotification);
                count++;
            }
            notificationsResult = notificationsList;
            return count;
        }
 private void ExecuteNotifications(WoopsaClientNotifications notifications)
 {
     List<int> lostSubscriptions = null;
     // Synchronize with the notification registration process to be sure we will not
     // process notifications for subscriptions that are not yet completely registered
     lock (_subscriptionLock)
     {
         foreach (WoopsaClientNotification notification in notifications.Notifications)
         {
             if (_registeredSubscriptions.ContainsKey(notification.SubscriptionId))
                 _registeredSubscriptions[notification.SubscriptionId].Execute(notification);
             else
             {
                 // there is a lost Subscription in the server which produces notifications, we have to unsubscribe it
                 if (lostSubscriptions == null)
                     lostSubscriptions = new List<int>();
                 lostSubscriptions.Add(notification.SubscriptionId);
             }
             if (notification.Id > _lastNotificationId)
                 _lastNotificationId = notification.Id;
         }
     }
     if (lostSubscriptions != null)
         lock (_lostSubscriptions)
             _lostSubscriptions.AddRange(lostSubscriptions);
 }