/**
   * Check if the given action is valid or not. This means check if the current action causes us to
   * over-stock our fridge
   *
   * @param currentAction - The action we are looking at
   * @param currentState - The state we are looking at
   * @return true if currentAction leads to state having more than the capacity of the fridge. false
   *     otherwise
   */
  private boolean validAction(Action currentAction, State currentState) {
    int sumOfAction = sumOf(currentAction.getPurchases());
    int sumOfState = sumOf(currentState.getState());

    if ((sumOfAction + sumOfState) > fridge.getCapacity()) {
      return false;
    }
    return true;
  }
 @Override
 public void onPause() {
   super.onPause();
   Fridge.getInstance().saveToFile(getApplicationContext());
   RecipeBook.getInstance().saveToFile(getApplicationContext());
 }