public async Task SetDataAsync(string id, byte[] data, uint?extraFlags, TimeSpan?timeout, CancellationToken cancellationToken)
        {
            var db = await DbContextProvider.GetDbContextAsync();

            var ob = await db.Sessions.FirstOrDefaultAsync(i => i.Key == id, cancellationToken);

            if (ob == null)
            {
                db.Sessions.Add(ob = new SessionObject()
                {
                    Key = id
                });
            }

            ob.ExtraFlags = extraFlags;
            ob.Timeout    = timeout;
            ob.Altered    = DateTime.UtcNow;
            await db.SaveChangesAsync(cancellationToken);

            var dt = await db.SessionData.FirstOrDefaultAsync(i => i.Id == ob.Id, cancellationToken);

            if (dt == null)
            {
                db.SessionData.Add(dt = new SessionDataObject()
                {
                    Id = ob.Id
                });
            }

            dt.Value = data;
            ob.Data  = dt;
            await db.SaveChangesAsync(cancellationToken);
        }
        public async Task SetTimeoutAsync(string id, TimeSpan?timeout, CancellationToken cancellationToken)
        {
            var db = await DbContextProvider.GetDbContextAsync();

            var ob = await db.Sessions.FirstOrDefaultAsync(i => i.Key == id, cancellationToken);

            if (ob == null)
            {
                db.Sessions.Add(ob = new SessionObject()
                {
                    Key = id
                });
            }

            ob.Timeout = timeout;

            await db.SaveChangesAsync(cancellationToken);
        }
        public async Task SetFlagAsync(string id, uint?extraFlags, CancellationToken cancellationToken)
        {
            var db = await DbContextProvider.GetDbContextAsync();

            var ob = await db.Sessions.FirstOrDefaultAsync(i => i.Key == id, cancellationToken);

            if (ob == null)
            {
                db.Sessions.Add(ob = new SessionObject()
                {
                    Key = id
                });
            }

            ob.ExtraFlags = extraFlags;

            await db.SaveChangesAsync(cancellationToken);
        }
        public async Task SetLockAsync(string id, uint cookie, DateTime time, CancellationToken cancellationToken)
        {
            var db = await DbContextProvider.GetDbContextAsync();

            var ob = await db.Sessions.FirstOrDefaultAsync(i => i.Key == id, cancellationToken);

            if (ob == null)
            {
                db.Sessions.Add(ob = new SessionObject()
                {
                    Key = id
                });
            }

            ob.LockCookie = cookie;
            ob.LockTime   = time;

            await db.SaveChangesAsync(cancellationToken);
        }