// Notification raised after ADAL accessed the cache.
        // If the HasStateChanged flag is set, ADAL changed the content of the cache
        async void AfterAccessNotification(TokenCacheNotificationArgs args)
        {
            //Task task;
            // if state changed
            if (this.HasStateChanged)
            {
                var enc = Utils.Encrypt(this.Serialize());

                if (Cache != null)
                {
                    Cache.CacheBits = enc.EncryptedData;
                    Cache.Salt      = enc.VectorData;
                    Cache.LastWrite = DateTime.Now;
                    // update the DB and the lastwrite
                    await PerWebUserCache.UpdateEntry(Cache);
                }
                else
                {
                    Cache = new PerWebUserCache
                    {
                        WebUserUniqueId = _userObjId,
                        CacheBits       = enc.EncryptedData,
                        Salt            = enc.VectorData,
                        LastWrite       = DateTime.Now,
                        HostName        = _hostName
                    };
                    await PerWebUserCache.AddEntry(Cache);
                }

                this.HasStateChanged = false;
            }
        }