public function onBeforeWrite()
    {
        parent::onBeforeWrite();

        if (!$this->supportsElemental()) {
            return;
        }

        $elementalAreaRelations = $this->owner->getElementalRelations();

        $this->ensureElementalAreasExist($elementalAreaRelations);

        if (Config::inst()->get(self::class, 'clear_contentfield')) {
            $this->owner->Content = '';
        }
    }