public List<CellGroup> loadCellGroup(String type) {
    List<CellGroup> list = new ArrayList<>();
    Cursor cursor = null;
    try {
      cursor =
          getReadableDatabase()
              .query(
                  CellGroup.NAME,
                  null,
                  "type=?",
                  new String[] {type},
                  "type, name",
                  null,
                  "status desc, name");
      if (cursor.getCount() > 0) {
        cursor.moveToFirst();
        do {
          CellGroup cellGroup =
              new CellGroup(cursor.getString(1), cursor.getString(2), cursor.getInt(3));
          cellGroup.setId(cursor.getInt(0));
          list.add(cellGroup);
        } while (cursor.moveToNext());
      }
    } finally {
      if (cursor != null) {
        cursor.close();
      }
    }

    return list;
  }
 public long addOrUpdateCellGroup(CellGroup cellGroup) {
   ContentValues content = new ContentValues();
   content.put("status", cellGroup.getStatus());
   content.put("name", cellGroup.getName());
   content.put("type", cellGroup.getType());
   return addOrUpdate(cellGroup.getId(), CellGroup.NAME, content);
 }
 public int toggleCellGroup(CellGroup group) {
   ContentValues content = new ContentValues();
   content.put(
       "status",
       group.getStatus() == CellGroup.STATUS.ENABLED.getValue()
           ? CellGroup.STATUS.DISABLED.getValue()
           : CellGroup.STATUS.ENABLED.getValue());
   return getWritableDatabase().update(CellGroup.NAME, content, "id=" + group.getId(), null);
 }