private function createAppendStream(array $elements): StreamInterface
    {
        $stream = new AppendStream();

        foreach ($elements as $element) {
            $this->addElement($stream, $element);
        }

        // Add the trailing boundary with CRLF
        $stream->addStream(Util::createStreamFor("--{$this->boundary}--\r\n"));

        return $stream;
    }