private static void ValidateEnvelopeAndThrowIfInvalid(AbstractEnvelope envelope, string prefix)
        {
            List <string> validationMessages;
            var           isValid = SdpXmlValidator.Instance.Validate(envelope.Xml().OuterXml, out validationMessages);

            if (!isValid)
            {
                var errorDescription = $"Ikke gyldig innhold i {prefix}. {validationMessages.Aggregate((current, variable) => current + Environment.NewLine + variable)}";
                Log.Warn(errorDescription);
                throw new XmlValidationException(errorDescription, validationMessages);
            }
        }
        private async Task <string> Send(AbstractEnvelope envelope, DocumentBundle asiceDocumentBundle = null)
        {
            if (ClientConfiguration.LoggForespørselOgRespons && RequestResponseLog.IsDebugEnabled)
            {
                RequestResponseLog.Debug($"Utgående {envelope.GetType().Name}, conversationId '{envelope.EnvelopeSettings.Forsendelse?.KonversasjonsId}', messageId '{envelope.EnvelopeSettings.GuidUtility.MessageId}': {envelope.Xml().OuterXml}");
            }

            var requestUri  = RequestUri(envelope);
            var httpContent = CreateHttpContent(envelope, asiceDocumentBundle);

            var responseMessage = await HttpClient.PostAsync(requestUri, httpContent).ConfigureAwait(false);

            var responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false);

            if (ClientConfiguration.LoggForespørselOgRespons && RequestResponseLog.IsDebugEnabled)
            {
                RequestResponseLog.Debug($" Innkommende {responseContent}");
            }

            return(responseContent);
        }