public Task<long> MyDevices_Insert(string session, string name, string value)
        {
            var yield = new TaskCompletionSource<long>();

            Console.WriteLine("enter MyDevices_Insert");
            this.account.SelectByCookie(
                new MyAccountQueries.SelectByCookie { cookie = session },
                r =>
                {
                    long account = r.id;


                    this.MyDevices.account = account;
                    this.MyDevices.MyDevices_Insert(
                        //"" + account,
                        name,
                        value

                      ).ContinueWithResult(yield.SetResult);
                }
            );
            Console.WriteLine("exit MyDevices_Insert");
            return yield.Task;
        }
        public Task MyDevices_SelectByAccount(string session, Action<long, string, string> yield)
        {
            var done = new TaskCompletionSource<long>();

            // ex = {"{ Message = database is locked\r\ndatabase is locked, StackTrace =    at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt)\r\n   at System.Data.SQLite.SQLiteDataReader.NextResult()\r\n   at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, ...

            Console.WriteLine("enter MyDevices_SelectByAccount");

            this.account.SelectByCookie(
               new MyAccountQueries.SelectByCookie { cookie = session },
               r =>
               {
                   long account = r.id;

                   this.MyDevices.account = account;
                   this.MyDevices.MyDevices_SelectByAccount(
                       //"" + account, 
                       yield
                     ).ContinueWith(
                    delegate
                    {
                        done.SetResult(0);
                    }
                    );
               }
           );
            Console.WriteLine("exit MyDevices_SelectByAccount");
            return done.Task;
        }
        public Task MyDevices_Update(string session, long id, string name, string value)
        {
            var done = new TaskCompletionSource<long>();
            Console.WriteLine("enter MyDevices_Update");
            this.account.SelectByCookie(
                 new MyAccountQueries.SelectByCookie { cookie = session },
                 r =>
                 {
                     long account = r.id;


                     //Additional information: database is locked

                     //database is locked


                     Console.WriteLine("before this.MyDevices.MyDevices_Update");

                     this.MyDevices.account = account;
                     this.MyDevices.MyDevices_Update(
                         //"" + account,
                         id,
                         name,
                         value
                     ).ContinueWith(
                        delegate
                        {
                            done.SetResult(0);
                        }
                     );

                     Console.WriteLine("after this.MyDevices.MyDevices_Update");

                 }
             );
            Console.WriteLine("exit MyDevices_Update");
            return done.Task;
        }