void IDialogContextStore.Save(IDialogContextInternal context)
        {
            byte[] blobNew;
            using (var streamNew = new MemoryStream())
                using (var gzipNew = new GZipStream(streamNew, CompressionMode.Compress))
                {
                    formatter.Serialize(gzipNew, context);
                    gzipNew.Close();
                    blobNew = streamNew.ToArray();
                }

            this.Bag.SetValue(this.key, blobNew);
        }
 bool IDialogContextStore.TryLoad(out IDialogContextInternal context)
 {
     if (store.TryLoad(out context))
     {
         return(true);
     }
     else
     {
         IFiberLoop fiber = new Fiber(frames);
         context = new DialogContext(botToUser, botData, fiber);
         return(false);
     }
 }
 bool IDialogContextStore.TryLoad(out IDialogContextInternal context)
 {
     try
     {
         return(this.store.TryLoad(out context));
     }
     catch (Exception)
     {
         // exception in loading the serialized context data
         context = null;
         return(false);
     }
 }
        bool IDialogContextStore.TryLoad(out IDialogContextInternal context)
        {
            byte[] blobOld;
            bool   found = this.Bag.TryGetValue(this.key, out blobOld);

            if (found)
            {
                using (var streamOld = new MemoryStream(blobOld))
                    using (var gzipOld = new GZipStream(streamOld, CompressionMode.Decompress))
                    {
                        context = (IDialogContextInternal)this.formatter.Deserialize(gzipOld);
                        return(true);
                    }
            }

            context = null;
            return(false);
        }
 void IDialogContextStore.Save(IDialogContextInternal context)
 {
     this.store.Save(context);
 }