public function map($rawData, $targetClass)
    {
        // Deserialize the data
        try {
            if ($this->serializer instanceof SerializerInterface === false) {
                throw new SerializerException("You've to specify a serializer with the setSerializer() method.");
            }

            $data = $this->serializer->deserialize($rawData);
        } catch (\Exception $e) {
            throw new SerializerException('Deserialize failed: ' . $e->getMessage(), 0, $e);
        }

        // Pre initialize the result
        $result = null;

        // Check if the target object is a collection of type X
        if (substr($targetClass, -2) == '[]') {
            $result = [];
            foreach ($data as $key => $entryData) {
                // Map the data recursive
                $result[] = $this->mapDataToObject($entryData, substr($targetClass, 0, -2));
            }
        } else {
            // Map the data recursive
            $result = $this->mapDataToObject($data, $targetClass);
        }

        return $result;
    }