protected function mergeFields(&$resource, $input)
    {
        $existingNames = Collect($resource->fields)->pluck('name')->all();
        $fields = FieldTransformer::fromString($this->option('fields'), 'generic', $input->translationFor);
        $mergeFields = 0;
        foreach ($fields as $field) {
            if (in_array($field->name, $existingNames)) {
                $this->warn('The field "' . $field->name . '" already exists in the file.');
                continue;
            }

            $existingNames[] = $field->name;
            $resource->fields[] = $field;
            $mergeFields++;
        }

        return $mergeFields;
    }