/// <summary>
        /// Adds submission result.
        /// </summary>
        /// <param name="returnType">
        /// The return type.
        /// </param>
        /// <param name="structureReference">
        /// The structure reference.
        /// </param>
        /// <param name="exception">
        /// The exception.
        /// </param>
        private void AddSubmissionResult(
            SubmitStructureResponseType returnType, IStructureReference structureReference, Exception exception)
        {
            var submissionResult = new SubmissionResultType();
            returnType.SubmissionResult.Add(submissionResult);
            var statusMessageType = new StatusMessageType();
            submissionResult.StatusMessage = statusMessageType;
            this.AddStatus(statusMessageType, exception);
            var submittedStructure = new SubmittedStructureType();
            submissionResult.SubmittedStructure = submittedStructure;
            var refType = new MaintainableReferenceType();
            submittedStructure.MaintainableObject = refType;
            if (ObjectUtil.ValidString(structureReference.MaintainableUrn))
            {
                refType.URN.Add(structureReference.MaintainableUrn);
            }
            else
            {
                var xref = new MaintainableRefType();
                refType.SetTypedRef(xref);
                IMaintainableRefObject maintainableReference = structureReference.MaintainableReference;
                string value = maintainableReference.AgencyId;
                if (!string.IsNullOrWhiteSpace(value))
                {
                    xref.agencyID = maintainableReference.AgencyId;
                }

                string value1 = maintainableReference.MaintainableId;
                if (!string.IsNullOrWhiteSpace(value1))
                {
                    xref.agencyID = maintainableReference.MaintainableId;
                }

                string value2 = maintainableReference.Version;
                if (!string.IsNullOrWhiteSpace(value2))
                {
                    xref.agencyID = maintainableReference.Version;
                }
            }
        }
        /// <summary>
        /// Gets new submission result type.
        /// </summary>
        /// <param name="returnType">
        /// The return type.
        /// </param>
        /// <param name="exception">
        /// The exception.
        /// </param>
        /// <returns>
        /// The <see cref="SubmissionResultType"/>.
        /// </returns>
        private static SubmissionResultType GetNewSubmissionResultType(
            SubmitStructureResponseType returnType, Exception exception)
        {
            var submissionResult = new SubmissionResultType();
            returnType.SubmissionResult.Add(submissionResult);
            var statusMessage = new StatusMessageType();
            submissionResult.StatusMessage = statusMessage;
            if (exception == null)
            {
                statusMessage.status = StatusTypeConstants.Success;
            }
            else
            {
                statusMessage.status = StatusTypeConstants.Failure;
                var tt = new TextType();
                statusMessage.MessageText.Add(tt);
                var uncheckedException = exception as SdmxException;
                tt.TypedValue = uncheckedException != null ? uncheckedException.FullMessage : exception.Message;
            }

            return submissionResult;
        }