private function buildJsonSerialize(array $serialize, $indent, array &$result)
    {
        if (count($serialize)) {
            $result[] = '';
            $result[] = $indent . '/**';
            $result[] = $indent . ' * Prepare object properties so they can be serialized to JSON.';
            $result[] = $indent . ' *';
            $result[] = $indent . ' * @return array';
            $result[] = $indent . ' */';
            $result[] = $indent . 'public function jsonSerialize()';
            $result[] = $indent . '{';
            $result[] = $indent . '    return array_merge(parent::jsonSerialize(), [';

            foreach ($serialize as $field) {
                $result[] = $indent . '        ' . var_export($field, true) . ' => $this->' . $this->getGetterName($field) . '(),';
            }

            $result[] = $indent . '    ]);';
            $result[] = $indent . '}';
        }
    }