public function map(array $record, $expression, $context = null, $key = null)
    {
        // Null or scalar values.
        if (null === $expression || is_scalar($expression)) {
            return $expression;
        }

        // Strategy.
        if ($expression instanceof Strategy) {
            return $this->mapStrategy($record, $expression, $context, $key);
        }

        // Mapping.
        if ($expression instanceof Mapping) {
            return $this->mapMapping($record, $expression, $context, $key);
        }

        // Mapping fragment.
        if (is_array($expression)) {
            return $this->mapFragment($record, $expression, $context, $key);
        }

        throw new InvalidExpressionException('Invalid strategy or mapping: "' . get_class($expression) . '".');
    }