protected function matchAsAttributes(array $attributes) : array
    {
        $attributesMap = $this->getAttributesDictionnary();

        // Get the subset that only the embedded object is concerned with and, convert it back
        // to embedded object attributes keys
        $originalAttributes = array_only($attributes, $attributesMap);

        $embeddedAttributes = [];

        foreach ($originalAttributes as $key => $value) {
            $embeddedKey = array_search($key, $attributesMap);
            $embeddedAttributes[$embeddedKey] = $value;
        }

        // Unset original attributes before, just in case one of the keys of the
        // original attributes is equals the relation name.
        foreach (array_keys($originalAttributes) as $key) {
            unset($attributes[$key]);
        }

        // Build object
        $attributes[$this->relation] = $this->buildEmbeddedObject($embeddedAttributes);

        return $attributes;
    }