anchor.diff:  
     deleteServer(int id) async {
       final db = await database;
  -
  -    db.delete('servers', where: 'id = ?', whereArgs: [id]);
  +    var batch = db.batch();
  +
  +    int count = Sqflite.firstIntValue(
  +        await db.rawQuery('SELECT COUNT(*) FROM servers'));
  +
  +    batch.delete('servers', where: 'id = ?', whereArgs: [id]);
  +
  +    if (count > 1) {
  +      int sortIndex = await db
  +          .query(
  +            'servers',
  +            columns: ['sort_index'],
  +            where: 'id = ?',
  +            whereArgs: [id],
  +          )
  +          .then((value) => value.first['sort_index']);
  +
  +      for (var i = count - 1; i > sortIndex; i--) {
  +        batch.update(
  +          'servers',
  +          {'sort_index': i - 1},
  +          where: 'sort_index = ?',
  +          whereArgs: [i],
  +        );
  +      }
  +    }
  +    batch.commit();
     }
   
     updateServer(ServerModel server) async {
  
positive.code: 
      return await openDatabase(
        path,
        version: 4,
        onOpen: (db) async {},
        onCreate: (Database db, int version) async {
          var batch = db.batch();
          _createTableServerV4(batch);
          await batch.commit();
        },
        onUpgrade: (Database db, int oldVersion, int newVersion) async {
          var batch = db.batch();
          if (oldVersion == 1) {
            _updateTableServerV1toV4(batch);
          }
          if (oldVersion == 2) {
            _updateTableServerV2toV4(batch);
          }
          if (oldVersion == 3) {
            _updateTableServerV3toV4(batch);
          }
          await batch.commit();
        },
      );
    }
  
    void _createTableServerV4(Batch batch) {
      batch.execute('''CREATE TABLE servers(
                      id INTEGER PRIMARY KEY,
                      plex_name TEXT,
                      plex_identifier TEXT,
                      tautulli_id TEXT,
  
negative.code:                 )''');
    }
  
    void _updateTableServerV1toV5(Batch batch) {
      batch.execute('ALTER TABLE servers ADD plex_pass INTEGER');
      batch.execute('ALTER TABLE servers ADD date_format TEXT');
      batch.execute('ALTER TABLE servers ADD time_format TEXT');
      batch.execute('ALTER TABLE servers ADD plex_identifier TEXT');
      batch.execute('ALTER TABLE servers ADD sort_index INTEGER');
    }
  
    void _updateTableServerV2toV5(Batch batch) {
      batch.execute('ALTER TABLE servers ADD date_format TEXT');
      batch.execute('ALTER TABLE servers ADD time_format TEXT');
      batch.execute('ALTER TABLE servers ADD plex_identifier TEXT');
      batch.execute('ALTER TABLE servers ADD sort_index INTEGER');
    }
  
    void _updateTableServerV3toV5(Batch batch) {
      batch.execute('ALTER TABLE servers ADD plex_identifier TEXT');
      batch.execute('ALTER TABLE servers ADD sort_index INTEGER');
    }
  
    void _updateTableServerV4toV5(Batch batch) {
      batch.execute('ALTER TABLE servers ADD sort_index INTEGER');
    }
  
    Future<void> _addInitialIndexValue(Database db, Batch batch) async {
      var servers = await db.query('servers');
      for (var i = 0; i <= servers.length - 1; i++) {
        batch.update(
          'servers',
          {'sort_index': i},
          where: 'id = ?',
          whereArgs: [servers[i]['id']],
        );
      }
    }
  
    addServer(ServerModel server) async {
  