public ExeciseSet getExerciseSetSet(int exerciseId, int order) {
    SQLiteDatabase db = this.getWritableDatabase();
    String query =
        "SELECT * FROM "
            + TABLE_EXERCISE_SET_REPETITIONS
            + " WHERE "
            + TABLE_EXERCISE_DETAIL
            + KEY_ID
            + " = "
            + exerciseId
            + " ORDER BY "
            + KEY_DATE
            + " DESC";

    Cursor c = db.rawQuery(query, null);
    ExeciseSet exerciseSet = new ExeciseSet();

    int i = 0;
    while (c.moveToNext()) {
      if (i == order) {
        exerciseSet.setWeight(c.getInt(c.getColumnIndex(KEY_WEIGHT)));
        exerciseSet.setRepetition(c.getInt(c.getColumnIndex(KEY_REPETITIONS)));
        c.close();
        return exerciseSet;
      } else {
        i++;
      }
    }
    c.close();
    return null;
  }
  public void saveExerciseSet(List<Exercise> exrcises) {
    SQLiteDatabase db = this.getWritableDatabase();

    ContentValues values;
    for (Exercise exercise : exrcises) {

      for (ExeciseSet exerciseSet : exercise.getAllSets()) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = new Date();
        values = new ContentValues();

        values.put(TABLE_EXERCISE_DETAIL + KEY_ID, exercise.getId());
        values.put(KEY_WEIGHT, exerciseSet.getWeight());
        values.put(KEY_REPETITIONS, exerciseSet.getRepetition());
        values.put(KEY_DATE, dateFormat.format(date));
        db.insert(TABLE_EXERCISE_SET_REPETITIONS, null, values);
      }
    }
  }