/// <summary>
 /// Handles the explicit.
 /// </summary>
 /// <param name="complexDataQuery">The complex data query.</param>
 /// <param name="structure">The structure.</param>
 private static void HandleExplicit(IComplexDataQuery complexDataQuery, DataStructureRequestType structure)
 {
     if (complexDataQuery.HasExplicitMeasures())
     {
         structure.explicitMeasures = complexDataQuery.HasExplicitMeasures();
     }
 }
        /// <summary>
        /// Handles the structure request type
        /// </summary>
        /// <param name="complexDataQuery">The complex data query.</param>
        /// <param name="dataReturnDetails">The data return details.</param>
        private static void HandleStructure(IComplexDataQuery complexDataQuery, DataReturnDetailsType dataReturnDetails)
        {
            var structure = new DataStructureRequestType();
            dataReturnDetails.Structure.Add(structure);
            if (!string.IsNullOrWhiteSpace(complexDataQuery.DimensionAtObservation))
            {
                structure.dimensionAtObservation = complexDataQuery.DimensionAtObservation;
            }
            else
            {
                structure.dimensionAtObservation = DimensionObject.TimeDimensionFixedId;
            }

            HandleExplicit(complexDataQuery, structure);
            structure.structureID = DefaultStructureId;
            
            if (complexDataQuery.DataStructure != null)
            {
                RefBaseType structureRefernce = new StructureRefType();
                structureRefernce.agencyID = complexDataQuery.DataStructure.AgencyId;
                structureRefernce.id = complexDataQuery.DataStructure.Id;
                structureRefernce.version = complexDataQuery.DataStructure.Version;
                var structureType = new StructureReferenceType();
                structureType.SetTypedRef(structureRefernce);
                structure.Structure = structureType;
            }
            else if (complexDataQuery.ProvisionAgreement != null)
            {
                RefBaseType provisionAgreementReference = new ProvisionAgreementRefType();
                provisionAgreementReference.id = complexDataQuery.ProvisionAgreement.Id;
                provisionAgreementReference.agencyID = complexDataQuery.ProvisionAgreement.AgencyId;
                provisionAgreementReference.version = complexDataQuery.ProvisionAgreement.Version;
                var provisionAgreementReferenceType = new ProvisionAgreementReferenceType();
                provisionAgreementReferenceType.SetTypedRef(provisionAgreementReference);
                structure.ProvisionAgrement = provisionAgreementReferenceType;
            }
        }