public static List<Task> getAll() {
    DatabaseHelper databaseHelper = DatabaseHelper.getInstance();
    SQLiteDatabase db = databaseHelper.getReadableDatabase();

    Cursor cursor =
        db.query(TaskContract.TABLE, TaskContract.COLUMNS, null, null, null, null, TaskContract.ID);
    List<Task> values = TaskContract.getTasks(cursor);

    db.close();
    databaseHelper.close();
    return values;
  }
  public static void save(Task task) {
    DatabaseHelper databaseHelper = DatabaseHelper.getInstance();
    SQLiteDatabase db = databaseHelper.getWritableDatabase();

    ContentValues values = TaskContract.getContentValues(task);
    if (task.getId() == null) {
      db.insert(TaskContract.TABLE, null, values);
    } else {
      String where = TaskContract.ID + " = ? ";
      String[] params = {task.getId().toString()};
      db.update(TaskContract.TABLE, values, where, params);
    }

    db.close();
    databaseHelper.close();
  }