public function validate($dataOrRequest, array $rules, array $messages = [], array $customAttributes = []) {
        $errors = $this->validateAndReturnErrors($dataOrRequest, $rules, $messages, $customAttributes);
        if (!empty($errors)) {
            $this->throwValidationErrorsResponse($errors);
        }

        return $this->extractInputFromRules($dataOrRequest, $rules);
    }