internal static bool GetBoundaryAndEncodingFromMultipartMixedContentType(string contentType, out string boundary, out Encoding encoding)
        {
            boundary = null;
            encoding = null;

            string mime;

            KeyValuePair <string, string>[] parameters = HttpProcessUtility.ReadContentType(contentType, out mime, out encoding);

            if (String.Equals(XmlConstants.MimeMultiPartMixed, mime, StringComparison.OrdinalIgnoreCase))
            {
                if (null != parameters)
                {
                    foreach (KeyValuePair <string, string> parameter in parameters)
                    {
                        if (String.Equals(parameter.Key, XmlConstants.HttpMultipartBoundary, StringComparison.OrdinalIgnoreCase))
                        {
                            if (boundary != null)
                            {
                                boundary = null;
                                break;
                            }

                            boundary = parameter.Value;
                        }
                    }
                }

                if (String.IsNullOrEmpty(boundary))
                {
                    throw Error.BatchStreamMissingBoundary();
                }
            }

            return(null != boundary);
        }