public function saveInto(DataObjectInterface $record) { if ($this->name) { $tags = explode(',', $this->dataValue()); if (!$record instanceof SummitEvent) { return; } $record->Tags()->removeAll(); foreach ($tags as $t) { $tag = Tag::get()->filter('Tag', $t)->first(); if (is_null($tag)) { $tag = Tag::create(array('Tag' => $t)); $tag->write(); } $record->Tags()->add($tag); } } }