/// <summary>
        /// If there is a <see cref="WorkflowHubSubscriber"/> it will deque messages and send them.
        /// Otherwise the queue remain unchainges
        /// </summary>
        private void TrySendMessagesInternal()
        {
            lock (WorkflowHubLock.GetLock(CorrelationId))
            {
                if (!(_subscriber is null) && Messages.Count > 0)
                {
                    WorflowFeedMessage message = Messages.Dequeue();

                    switch (message.Type)
                    {
                    case WorkflowFeedMessageType.StatusDone:
                        _subscriber.SendResponseStatusDone(message.Message);
                        break;

                    case WorkflowFeedMessageType.StatusError:
                        _subscriber.SendResponseStatusError(message.Message);
                        break;

                    case WorkflowFeedMessageType.NotificationInfo:
                        _subscriber.SendResponseNotificationInfo(message.Message);
                        break;

                    case WorkflowFeedMessageType.NotificationInfoModel:
                        _subscriber.SendResponseNotificationInfoModel(message.Message);
                        break;

                    case WorkflowFeedMessageType.NotificationWarning:
                        _subscriber.SendResponseNotificationWarning(message.Message);
                        break;

                    case WorkflowFeedMessageType.NotificationError:
                        _subscriber.SendResponseNotificationError(message.Message);
                        break;

                    default:
                        throw new Exception();
                    }

                    if (Messages.Count > 0)
                    {
                        TrySendMessagesInternal();
                    }
                }
            }
        }