protected function writeToModel($modelFile, $inPlaceholder = "    //")
    {
        $replaces = [];
        $searches = [];

        foreach ($this->getProperties() as $property => $content) {
            $replaces[] = $this->parsePropertyValue($content);
            $searches[] = '{{' . $property . '}}';
        } // foreach

        $methodContent = '';
        $newContent = str_replace(
            $searches,
            $replaces,
            file_get_contents(realpath(__DIR__ . '/stubs/model-content.stub'))
        );

        if ($keys = $this->getForeignKeys()) {
            $methodContent = implode("\n\n", $this->getMethodCallsForForeignKeys());
        } // if

        $newContent = str_replace(
            ["    // {{relations}}", '// {{traits}}'],
            [$methodContent, ($traits = $this->getTraits()) ? 'use ' . implode(', ', $traits) . ';' : ''],
            $newContent
        );

        $written = file_put_contents(
            $modelFile,
            str_replace(
                $inPlaceholder,
                $newContent,
                file_get_contents($modelFile)
            )
        );

        if ($written) {
            // Success of formatting is optional.
            if (DIRECTORY_SEPARATOR === '\\') {
                $exec = ".\\vendor\\bin\\phpcbf.bat {$modelFile} --standard=PSR2";
            } else {
                $exec = "vendor/bin/phpcbf {$modelFile} --standard=PSR2";
            }

            @exec($exec, $output, $return);
        } // if

        return $written;
    }