protected function validateCategoryProduct()
    {
        $fields = array(
            'category_id' => $this->translation->text('Category'),
            'brand_category_id' => $this->translation->text('Brand'),
        );

        $errors = 0;

        foreach ($fields as $field => $label) {

            $value = $this->getSubmitted($field);

            if (!isset($value)) {
                continue;
            }

            if (!is_numeric($value)) {
                $errors++;
                $this->setErrorNumeric($field, $label);
                continue;
            }

            if (empty($value)) {
                continue;
            }

            $category = $this->category->get($value);

            if (empty($category['category_id'])) {
                $errors++;
                $this->setErrorUnavailable($field, $label);
            }
        }

        return empty($errors);
    }