public function addMessage(string $type, $message, string $channel = FlashMessengerInterface::DEFAULT_CHANNEL)
    {
        if (!is_string($message) && !is_array($message)) {
            throw new InvalidArgumentException('Flash message must be a string or an array of strings');
        }

        $container = $this->getSessionContainer();
        if (!isset($container->messages)) {
            $container->messages = [];
        }

        if (!isset($container->messages[$channel])) {
            $container->messages[$channel] = [];
        }

        if (!isset($container->messages[$channel][$type])) {
            $container->messages[$channel][$type] = [];
        }

        $message = (array)$message;

        foreach ($message as $msg) {
            if (!is_string($msg)) {
                throw new InvalidArgumentException('Flash message must be a string or an array of strings');
            }
            $container->messages[$channel][$type][] = $msg;
        }
    }