public function unsetRelation($name, $value)
    {
        list($type, $foreign_class, $foreign_column, $column) = static::getRelationDefinition($name);

        //no need to get the relation, the column is on this object.
        if ($type === 'belongs_to') {
            $this->setRaw($column, $value);
            $this->relation_objects[$name] = false;

            return;
        }

        $related_object = $this->getRelation($name);

        if (!$related_object) {
            return;
        }

        //has one, the related object column is set to the value.
        if ($type === 'has_one') {
            $related_object->setRaw($foreign_column, $value);
            $this->relation_objects[$name] = false;
        }

        //has many, the columns on the entities in the related
        //collection are set to the value.
        if ($type === 'has_many') {
            $related_object->setColumnRaw($foreign_column, $value);
            $this->relation_objects[$name] = $foreign_class::newCollection();
        }

        return;
    }