@Override
  public boolean execute(String action, JSONArray args, CallbackContext callbackContext)
      throws JSONException {
    LocalNotification.webView = super.webView;
    LocalNotification.context = super.cordova.getActivity().getApplicationContext();

    if (action.equalsIgnoreCase("add")) {
      JSONObject arguments = args.optJSONObject(0);
      final Options options = new Options(context).parse(arguments);

      persist(options.getId(), args);

      cordova
          .getThreadPool()
          .execute(
              new Runnable() {
                public void run() {
                  add(options);
                }
              });

      return true;
    }

    if (action.equalsIgnoreCase("cancel")) {
      String id = args.optString(0);

      cancel(id);
      unpersist(id);

      return true;
    }

    if (action.equalsIgnoreCase("cancelAll")) {
      cancelAll();
      unpersistAll();

      return true;
    }

    // Returning false results in a "MethodNotFound" error.
    return false;
  }