src/Producer.php
public function &modify(EntityInterface &$instance, array $attributes = null, $save = true)
    {
        if ($attributes) {
            foreach ($attributes as $k => $v) {
                if ($instance->fieldExists($k)) {
                    $instance->setFieldValue($k, $v);
                } else {
                    $instance->setAttribute($k, $v);
                }
            }
        }

        if ($save) {
            $instance->save();
        }

        return $instance;
    }
public function &modify(EntityInterface &$instance, array $attributes = null, $save = true)
    {
        if ($attributes) {
            foreach ($attributes as $k => $v) {
                if ($instance->fieldExists($k)) {
                    $instance->setFieldValue($k, $v);
                } else {
                    $instance->setAttribute($k, $v);
                }
            }
        }

        if ($save) {
            $instance->save();
        }

        return $instance;
    }
{@inheritdoc}