protected function prepareMultipartData($params)
    {
        $multipart = [];

        if ($params instanceof Arrayable) {
            $params = $params->toArray();
        }

        foreach ($params as $key => $value) {

            if ( ! is_array($value)) {

                $multipart[] = [
                    'name'     => $key,
                    'contents' => $value,
                ];

                continue;
            }

            foreach (array_dot($value) as $dotKey => $leafValue) {

                $partKey = $key
                    . implode(
                        array_map(
                            function($partKey) { return "[{$partKey}]"; },
                            explode('.', $dotKey)
                        )
                    );

                $multipart[] = [
                    'name'     => $partKey,
                    'contents' => $leafValue,
                ];
            }
        }
        
        return $multipart;
    }