private function getFieldType($fieldName, $documentDefinition)
    {
        foreach ($documentDefinition->fields as $fieldTypeDefinition) {
            if ($fieldTypeDefinition->slug === $fieldName) {
                return $fieldTypeDefinition->type;
            }
        }

        throw new \Exception('Unknown field type for field' . $fieldName . ' in document ' . $this->document->path);
    }