public void RefreshApplicationCacheIfStale()
        {
            Thread.MemoryBarrier();
            var stale = _appCacheStale < DateTime.Now;
            Thread.MemoryBarrier();
            this.TraceData(TraceEventType.Information, "TMailService RefreshApplicationIfStale check if stale");
            //this.LogInfo("TMailService RefreshApplicationIfStale check if stale");
            if (stale)
            {
                this.TraceData(TraceEventType.Information, "TMailService RefreshApplicationIfStale is stale");
                //this.LogInfo("TMailService RefreshApplicationIfStale is stale");
                var config = StrongMailConfigurationSection.Instance;
                using (var studio = config.CreateMailingService())
                {

                    try
                    {
                        //this.LogInfo("TMailService RefreshApplicationIfStale is starting");
                        this.TraceData(TraceEventType.Information, "TMailService RefreshApplicationIfStale is starting");
                        var orgs = studio.AllOrganizations();
                        var atti = orgs.SingleOrDefault(o => o.name == "ATTI");

                        Thread.MemoryBarrier();
                        _appCache = orgs;
                        _atti = atti;
                        _appCacheStale = DateTime.Now.Add(CApplicationCacheTimeout);
                        Thread.MemoryBarrier();
                        this.TraceData(TraceEventType.Information, "TMailService RefreshApplicationIfStale is done");
                        //this.LogInfo("TMailService RefreshApplicationIfStale is done");
                    }
                    catch (WebException e)
                    {
                        //this.LogInfo("TMailService RefreshApplicationIfStale is stale with WebException {0}",e.Message);
                        this.TraceData(TraceEventType.Error, "TMailService RefreshApplicationIfStale is stale with WebException {0}", e.Message);
                        YPMon.Warn("STRONGMAIL_UNREACHABLE", e.FormatForLogging());
                    }
                    catch (SoapHeaderException e)
                    {
                        //this.LogInfo("TMailService RefreshApplicationIfStale is stale with SoapException {0}, with translated exception {1} ",
                       //	              e.Message,studio.TranslateException(e));
                        this.TraceData(TraceEventType.Error,
                            "TMailService RefreshApplicationIfStale is stale with SoapException {0}, with translated exception {1} ",
                            e.Message,studio.TranslateException(e));
                        throw studio.TranslateException(e);
                    }
                }
            }
        }
        private void RecursiveForEach(MailingService svc, int depth, Organization o, IEnumerable<Organization> orgs, Action<MailingService, int, Organization> action)
        {
            Assert.IsNotNull(o);

            action(svc, depth, o);
            foreach (var child in orgs.TakeChildrenOf(o))
            {
                RecursiveForEach(svc, depth + 1, child, orgs, action);
            }
        }