private int insertTileset(string tilesetName)
 {
     try
     {
         _sqlite.BeginTransaction(true);
         //return _sqlite.Insert(new tilesets { name = tilesetName });
         tilesets newTileset = new tilesets {
             name = tilesetName
         };
         int rowsAffected = _sqlite.Insert(newTileset);
         if (1 != rowsAffected)
         {
             throw new Exception(string.Format("tileset [{0}] was not inserted, rows affected:{1}", tilesetName, rowsAffected));
         }
         return(newTileset.id);
     }
     catch (Exception ex)
     {
         Debug.LogErrorFormat("could not insert tileset [{0}]: {1}", tilesetName, ex);
         return(-1);
     }
     finally
     {
         _sqlite.Commit();
     }
 }
        private int?getTilesetId(string tilesetName)
        {
            tilesets tileset = _sqlite
                               .Table <tilesets>()
                               .Where(ts => ts.name.Equals(tilesetName))
                               .FirstOrDefault();

            return(null == tileset ? (int?)null : tileset.id);
        }