/// <summary>
 /// Returns an <see cref="EventDeferral"/> which can be completed when deferred event is ready to continue.
 /// </summary>
 /// <returns><see cref="EventDeferral"/> instance.</returns>
 public EventDeferral GetDeferral()
 {
     lock (_eventDeferralLock)
     {
         return(_eventDeferral ?? (_eventDeferral = new EventDeferral()));
     }
 }
        internal EventDeferral GetCurrentDeferralAndReset()
        {
            lock (_eventDeferralLock)
            {
                var eventDeferral = _eventDeferral;

                _eventDeferral = null;

                return(eventDeferral);
            }
        }