private function clearForm(array $values, FormStateInterface &$form_state) {
    $input = $form_state->getUserInput();

    foreach ($values as $value) {
      if ($form_state->hasValue($value)) {
        $form_state->unsetValue($value);
      }

      if (isset($input[$value])) {
        unset($input[$value]);
      }
    }

    $form_state->setUserInput($input);
  }