protected function relationshipsToArray(): array
    {
        $relationships = [];

        foreach ($this->relationships as $name => $relationship)
        {
            $relationships[$name] = $relationship->toArray();
        }

        return $relationships;
    }