public static void Set(QueueSettingsScope scope)
 {
     if (HttpContext.Current != null)
     {
         if (scope == null)
         {
             HttpContext.Current.Items.Remove(QueueNameScopeKey);
         }
         else
         {
             HttpContext.Current.Items[QueueNameScopeKey] = scope;
         }
     }
     else
     {
         if (scope == null)
         {
             CallContext.FreeNamedDataSlot(QueueNameScopeKey);
         }
         else
         {
             CallContext.LogicalSetData(QueueNameScopeKey, scope);
         }
     }
 }
        public void Dispose()
        {
            var previousScope = _parentSettingsScope;
            _parentSettingsScope = null;

            Storage.Set(previousScope);

            GC.SuppressFinalize(this); 
        }
        public QueueSettingsScope(string queueName, bool overrideParent = false)
        {
            _parentSettingsScope = Storage.Get();

            if (_parentSettingsScope != null && !overrideParent)
            {
                queueName = _parentSettingsScope.QueueName;
            }

            QueueName = queueName;

            Storage.Set(this);
        }