private function hydrateToManyRelation($entity, $name, $targetEntity, $data, $scope)
    {
        if (!is_array($data)) {
            throw RestException::missingData($scope);
        }

        $this->setObjectProperty($entity, $name,
            new ArrayCollection(array_map(
                function($item, $index) use ($targetEntity, $scope) {
                    return $this->hydrateRelationData($targetEntity, $item, $scope.'['.$index.']');
                },
                $data,
                array_keys($data)
            ))
        );
    }