protected function setRules(bool $skipUniqueForUnchanged = false, array $record = null)
    {
        $this->mapFieldsRules($this->databaseTableValidation->getValidationRules());

        $uniqueColumns = $this->mapper->getUniqueColumns();

        if (count($uniqueColumns) > 0) {
            $this->addUniqueRule();

            foreach ($uniqueColumns as $databaseColumnMapper) {
                $field = $databaseColumnMapper->getName();
                // only set rule for changed columns if $skipUniqueForUnchanged is set true
                if ( !($skipUniqueForUnchanged && $this->inputData[$field] == $record[$field]) ) {
                    $this->rule('unique', $field, $databaseColumnMapper, $this);
                }
            }
        }
    }