/// <summary>
        /// The unsubscribe functionality for cancellable rules
        /// </summary>
        /// <param name="cancellableRule">
        /// The cancellable rule.
        /// </param>
        public void Unsubscribe(ICancellableRule cancellableRule)
        {
            if (cancellableRule == null)
            {
                this.logger?.LogError("Cancel received a null cancellable rule unsubscribe");
                return;
            }

            lock (this.ruleCancellationLock)
            {
                if (!this.cancellableRules.Contains(cancellableRule))
                {
                    return;
                }

                this.cancellableRules.Remove(cancellableRule);
            }
        }
        /// <summary>
        /// The post subscription check.
        /// </summary>
        /// <param name="cancellableRule">
        /// The cancellable rule.
        /// </param>
        private void PostSubscriptionCheck(ICancellableRule cancellableRule)
        {
            var matchedCancellations =
                this
                .cancellations
                .All()
                .Where(_ =>
                       string.Equals(_, cancellableRule?.Schedule?.CorrelationId, StringComparison.OrdinalIgnoreCase))
                .ToList();

            if (!matchedCancellations.Any())
            {
                return;
            }

            foreach (var cancelId in matchedCancellations)
            {
                this.Cancel(cancelId);
            }
        }
        /// <summary>
        /// The subscribe functionality for cancellable rules to provide access to cancellation requests.
        /// </summary>
        /// <param name="cancellableRule">
        /// The cancellable rule.
        /// </param>
        public void Subscribe(ICancellableRule cancellableRule)
        {
            if (cancellableRule == null)
            {
                this.logger?.LogError("Cancel received a null cancellable rule subscription");
                return;
            }

            lock (this.ruleCancellationLock)
            {
                if (this.cancellableRules.Contains(cancellableRule))
                {
                    return;
                }

                this.cancellableRules.Add(cancellableRule);
            }

            this.PostSubscriptionCheck(cancellableRule);
        }