public function saveAttributesData(int $categoryId, array $data)
    {
        $rows = [];
        $this->deleteByCategoryId($categoryId);

        $fields = $this->getConnection()->describeTable($this->getMainTable());
        foreach ($data as $item) {
            $item[$this->getIdFieldName()] = $categoryId;
            $row                           = $this->buildRow($item, $fields);
            if ($this->isValid($row)) {
                $rows[] = $row;
            }
        }

        $result = true;
        if (!empty($rows)) {
            $result = (bool) $this->getConnection()->insertArray($this->getMainTable(), array_keys($fields), $rows);
        }

        return $result;
    }