public function onBeforeWrite() {

		parent::onBeforeWrite();

		// Determine whether consolidated tags are found in the existing relationships.

		$types = array();
		foreach(singleton('FusionService')->getFusionTagTypes() as $type => $field) {
			$types[$type] = $type;
		}
		$types = array_intersect($this->owner->many_many(), $types);
		if(empty($types)) {

			// There are no consolidated tags found, therefore update the tagging based on the fusion tags.

			$tagging = array();
			foreach($this->owner->FusionTags() as $tag) {
				$tagging[] = $tag->Title;
			}
		}
		else {

			// Empty the fusion tags to begin.

			$this->owner->FusionTags()->removeAll();

			// There are consolidated tags found, therefore update the tagging based on these.

			$tagging = array();
			foreach($types as $relationship => $type) {
				foreach($this->owner->$relationship() as $tag) {

					// Update both the fusion tags and tagging (using the relationship causes caching issues).

					$fusion = FusionTag::get()->byID($tag->FusionTagID);
					$this->owner->FusionTags()->add($fusion);
					$tagging[] = $fusion->Title;
				}
			}
		}
		$this->owner->Tagging = implode(' ', $tagging);
	}