protected function setInstProperty($inst, $propertyName, $mappingDefinition, $propertyValue = null)
    {
        if ($mappingDefinition === false) {
            return false; // Do not even attempt to set this property
        }
        if (func_num_args() <= 3) {
            $propertyValue = $this->$propertyName;
        }
        if ($mappingDefinition === true ||
                is_string($mappingDefinition)) {
            $instPropertyName = $mappingDefinition === true ? $propertyName : $mappingDefinition;

            $setInstPropertyMethod = 'setInstProperty' . ucfirst($instPropertyName);
            if (method_exists($this, $setInstPropertyMethod)) {
                $this->$setInstPropertyMethod($propertyValue, $inst);
                return;
            } else {
                $instSetterMethod = 'set' . ucfirst($instPropertyName);
                if (method_exists($inst, $instSetterMethod)) {
                    $inst->$instSetterMethod($propertyValue);
                    return;
                } else {
                    $inst->$instPropertyName = $propertyValue;
                    return;
                }
            }
        } elseif (is_array($mappingDefinition)) {
            if (reset($mappingDefinition) === null) {
                $mappingDefinition[0] = $inst;
                call_user_func_array($mappingDefinition, [$propertyValue]);
                return;
            } elseif (reset($mappingDefinition) === $this) {
                call_user_func_array($mappingDefinition, [$propertyValue, $inst]);
                return;
            }
        }
        throw new \yii\base\ErrorException('Could not set property ' . $propertyName . ' in wrapped object');
    }