public static void SerializeConformanceRestSecurityComponent(Hl7.Fhir.Model.Conformance.ConformanceRestSecurityComponent value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartComplexContent();

            // Serialize element _id
            if (value.LocalIdElement != null)
            {
                writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute);
            }

            // Serialize element extension
            if (value.Extension != null && !summary && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element service
            if (value.Service != null && value.Service.Count > 0)
            {
                writer.WriteStartArrayElement("service");
                foreach (var item in value.Service)
                {
                    writer.WriteStartArrayMember("service");
                    CodeableConceptSerializer.SerializeCodeableConcept(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element description
            if (value.DescriptionElement != null)
            {
                writer.WriteStartElement("description");
                FhirStringSerializer.SerializeFhirString(value.DescriptionElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element certificate
            if (value.Certificate != null && value.Certificate.Count > 0)
            {
                writer.WriteStartArrayElement("certificate");
                foreach (var item in value.Certificate)
                {
                    writer.WriteStartArrayMember("certificate");
                    ConformanceSerializer.SerializeConformanceRestSecurityCertificateComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
        }
        public static void SerializeConformanceRestQueryComponent(Hl7.Fhir.Model.Conformance.ConformanceRestQueryComponent value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartComplexContent();

            // Serialize element _id
            if (value.LocalIdElement != null)
            {
                writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute);
            }

            // Serialize element extension
            if (value.Extension != null && !summary && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element name
            if (value.NameElement != null)
            {
                writer.WriteStartElement("name");
                FhirStringSerializer.SerializeFhirString(value.NameElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element documentation
            if (value.DocumentationElement != null)
            {
                writer.WriteStartElement("documentation");
                FhirStringSerializer.SerializeFhirString(value.DocumentationElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element parameter
            if (value.Parameter != null && value.Parameter.Count > 0)
            {
                writer.WriteStartArrayElement("parameter");
                foreach (var item in value.Parameter)
                {
                    writer.WriteStartArrayMember("parameter");
                    ConformanceSerializer.SerializeConformanceRestResourceSearchParamComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
        }
        public static void SerializeConformanceRestResourceComponent(Hl7.Fhir.Model.Conformance.ConformanceRestResourceComponent value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartComplexContent();

            // Serialize element _id
            if (value.LocalIdElement != null)
            {
                writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute);
            }

            // Serialize element extension
            if (value.Extension != null && !summary && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element type
            if (value.TypeElement != null)
            {
                writer.WriteStartElement("type");
                CodeSerializer.SerializeCode(value.TypeElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element profile
            if (value.Profile != null)
            {
                writer.WriteStartElement("profile");
                ResourceReferenceSerializer.SerializeResourceReference(value.Profile, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element operation
            if (value.Operation != null && value.Operation.Count > 0)
            {
                writer.WriteStartArrayElement("operation");
                foreach (var item in value.Operation)
                {
                    writer.WriteStartArrayMember("operation");
                    ConformanceSerializer.SerializeConformanceRestResourceOperationComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element readHistory
            if (value.ReadHistoryElement != null)
            {
                writer.WriteStartElement("readHistory");
                FhirBooleanSerializer.SerializeFhirBoolean(value.ReadHistoryElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element searchInclude
            if (value.SearchIncludeElement != null && value.SearchIncludeElement.Count > 0)
            {
                writer.WriteStartArrayElement("searchInclude");
                foreach (var item in value.SearchIncludeElement)
                {
                    writer.WriteStartArrayMember("searchInclude");
                    FhirStringSerializer.SerializeFhirString(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element searchParam
            if (value.SearchParam != null && value.SearchParam.Count > 0)
            {
                writer.WriteStartArrayElement("searchParam");
                foreach (var item in value.SearchParam)
                {
                    writer.WriteStartArrayMember("searchParam");
                    ConformanceSerializer.SerializeConformanceRestResourceSearchParamComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
        }
        public static void SerializeConformance(Hl7.Fhir.Model.Conformance value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Conformance");
            writer.WriteStartComplexContent();

            // Serialize element _id
            if (value.LocalIdElement != null)
            {
                writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute);
            }

            // Serialize element extension
            if (value.Extension != null && !summary && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element language
            if (value.LanguageElement != null && !summary)
            {
                writer.WriteStartElement("language");
                CodeSerializer.SerializeCode(value.LanguageElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element text
            if (value.Text != null && !summary)
            {
                writer.WriteStartElement("text");
                NarrativeSerializer.SerializeNarrative(value.Text, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element contained
            if (value.Contained != null && !summary && value.Contained.Count > 0)
            {
                writer.WriteStartArrayElement("contained");
                foreach (var item in value.Contained)
                {
                    writer.WriteStartArrayMember("contained");
                    FhirSerializer.SerializeResource(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element identifier
            if (value.IdentifierElement != null)
            {
                writer.WriteStartElement("identifier");
                FhirStringSerializer.SerializeFhirString(value.IdentifierElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element version
            if (value.VersionElement != null)
            {
                writer.WriteStartElement("version");
                FhirStringSerializer.SerializeFhirString(value.VersionElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element name
            if (value.NameElement != null)
            {
                writer.WriteStartElement("name");
                FhirStringSerializer.SerializeFhirString(value.NameElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element publisher
            if (value.PublisherElement != null)
            {
                writer.WriteStartElement("publisher");
                FhirStringSerializer.SerializeFhirString(value.PublisherElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element telecom
            if (value.Telecom != null && value.Telecom.Count > 0)
            {
                writer.WriteStartArrayElement("telecom");
                foreach (var item in value.Telecom)
                {
                    writer.WriteStartArrayMember("telecom");
                    ContactSerializer.SerializeContact(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element description
            if (value.DescriptionElement != null)
            {
                writer.WriteStartElement("description");
                FhirStringSerializer.SerializeFhirString(value.DescriptionElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element status
            if (value.StatusElement != null)
            {
                writer.WriteStartElement("status");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.Conformance.ConformanceStatementStatus>(value.StatusElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element experimental
            if (value.ExperimentalElement != null)
            {
                writer.WriteStartElement("experimental");
                FhirBooleanSerializer.SerializeFhirBoolean(value.ExperimentalElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element date
            if (value.DateElement != null)
            {
                writer.WriteStartElement("date");
                FhirDateTimeSerializer.SerializeFhirDateTime(value.DateElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element software
            if (value.Software != null)
            {
                writer.WriteStartElement("software");
                ConformanceSerializer.SerializeConformanceSoftwareComponent(value.Software, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element implementation
            if (value.Implementation != null)
            {
                writer.WriteStartElement("implementation");
                ConformanceSerializer.SerializeConformanceImplementationComponent(value.Implementation, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element fhirVersion
            if (value.FhirVersionElement != null)
            {
                writer.WriteStartElement("fhirVersion");
                IdSerializer.SerializeId(value.FhirVersionElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element acceptUnknown
            if (value.AcceptUnknownElement != null && !summary)
            {
                writer.WriteStartElement("acceptUnknown");
                FhirBooleanSerializer.SerializeFhirBoolean(value.AcceptUnknownElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element format
            if (value.FormatElement != null && !summary && value.FormatElement.Count > 0)
            {
                writer.WriteStartArrayElement("format");
                foreach (var item in value.FormatElement)
                {
                    writer.WriteStartArrayMember("format");
                    CodeSerializer.SerializeCode(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element rest
            if (value.Rest != null && !summary && value.Rest.Count > 0)
            {
                writer.WriteStartArrayElement("rest");
                foreach (var item in value.Rest)
                {
                    writer.WriteStartArrayMember("rest");
                    ConformanceSerializer.SerializeConformanceRestComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element messaging
            if (value.Messaging != null && !summary && value.Messaging.Count > 0)
            {
                writer.WriteStartArrayElement("messaging");
                foreach (var item in value.Messaging)
                {
                    writer.WriteStartArrayMember("messaging");
                    ConformanceSerializer.SerializeConformanceMessagingComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element document
            if (value.Document != null && !summary && value.Document.Count > 0)
            {
                writer.WriteStartArrayElement("document");
                foreach (var item in value.Document)
                {
                    writer.WriteStartArrayMember("document");
                    ConformanceSerializer.SerializeConformanceDocumentComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public static void SerializeConformanceMessagingComponent(Hl7.Fhir.Model.Conformance.ConformanceMessagingComponent value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartComplexContent();

            // Serialize element _id
            if (value.LocalIdElement != null)
            {
                writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute);
            }

            // Serialize element extension
            if (value.Extension != null && !summary && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element endpoint
            if (value.EndpointElement != null)
            {
                writer.WriteStartElement("endpoint");
                FhirUriSerializer.SerializeFhirUri(value.EndpointElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element reliableCache
            if (value.ReliableCacheElement != null)
            {
                writer.WriteStartElement("reliableCache");
                IntegerSerializer.SerializeInteger(value.ReliableCacheElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element documentation
            if (value.DocumentationElement != null)
            {
                writer.WriteStartElement("documentation");
                FhirStringSerializer.SerializeFhirString(value.DocumentationElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element event
            if (value.Event != null && value.Event.Count > 0)
            {
                writer.WriteStartArrayElement("event");
                foreach (var item in value.Event)
                {
                    writer.WriteStartArrayMember("event");
                    ConformanceSerializer.SerializeConformanceMessagingEventComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
        }
        public static void SerializeConformanceRestComponent(Hl7.Fhir.Model.Conformance.ConformanceRestComponent value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartComplexContent();

            // Serialize element _id
            if (value.LocalIdElement != null)
            {
                writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute);
            }

            // Serialize element extension
            if (value.Extension != null && !summary && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element mode
            if (value.ModeElement != null)
            {
                writer.WriteStartElement("mode");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.Conformance.RestfulConformanceMode>(value.ModeElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element documentation
            if (value.DocumentationElement != null)
            {
                writer.WriteStartElement("documentation");
                FhirStringSerializer.SerializeFhirString(value.DocumentationElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element security
            if (value.Security != null)
            {
                writer.WriteStartElement("security");
                ConformanceSerializer.SerializeConformanceRestSecurityComponent(value.Security, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element resource
            if (value.Resource != null && value.Resource.Count > 0)
            {
                writer.WriteStartArrayElement("resource");
                foreach (var item in value.Resource)
                {
                    writer.WriteStartArrayMember("resource");
                    ConformanceSerializer.SerializeConformanceRestResourceComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element batch
            if (value.BatchElement != null)
            {
                writer.WriteStartElement("batch");
                FhirBooleanSerializer.SerializeFhirBoolean(value.BatchElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element history
            if (value.HistoryElement != null)
            {
                writer.WriteStartElement("history");
                FhirBooleanSerializer.SerializeFhirBoolean(value.HistoryElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element query
            if (value.Query != null && value.Query.Count > 0)
            {
                writer.WriteStartArrayElement("query");
                foreach (var item in value.Query)
                {
                    writer.WriteStartArrayMember("query");
                    ConformanceSerializer.SerializeConformanceRestQueryComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
        }
 internal static void SerializeResource(Resource value, IFhirWriter writer, bool summary)
 {
     if (value.GetType() == typeof(Hl7.Fhir.Model.AdverseReaction))
     {
         AdverseReactionSerializer.SerializeAdverseReaction((Hl7.Fhir.Model.AdverseReaction)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Alert))
     {
         AlertSerializer.SerializeAlert((Hl7.Fhir.Model.Alert)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.AllergyIntolerance))
     {
         AllergyIntoleranceSerializer.SerializeAllergyIntolerance((Hl7.Fhir.Model.AllergyIntolerance)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.CarePlan))
     {
         CarePlanSerializer.SerializeCarePlan((Hl7.Fhir.Model.CarePlan)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Condition))
     {
         ConditionSerializer.SerializeCondition((Hl7.Fhir.Model.Condition)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Conformance))
     {
         ConformanceSerializer.SerializeConformance((Hl7.Fhir.Model.Conformance)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Coverage))
     {
         CoverageSerializer.SerializeCoverage((Hl7.Fhir.Model.Coverage)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Device))
     {
         DeviceSerializer.SerializeDevice((Hl7.Fhir.Model.Device)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.DeviceCapabilities))
     {
         DeviceCapabilitiesSerializer.SerializeDeviceCapabilities((Hl7.Fhir.Model.DeviceCapabilities)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.DeviceLog))
     {
         DeviceLogSerializer.SerializeDeviceLog((Hl7.Fhir.Model.DeviceLog)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.DeviceObservation))
     {
         DeviceObservationSerializer.SerializeDeviceObservation((Hl7.Fhir.Model.DeviceObservation)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.DiagnosticOrder))
     {
         DiagnosticOrderSerializer.SerializeDiagnosticOrder((Hl7.Fhir.Model.DiagnosticOrder)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.DiagnosticReport))
     {
         DiagnosticReportSerializer.SerializeDiagnosticReport((Hl7.Fhir.Model.DiagnosticReport)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Document))
     {
         DocumentSerializer.SerializeDocument((Hl7.Fhir.Model.Document)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.DocumentReference))
     {
         DocumentReferenceSerializer.SerializeDocumentReference((Hl7.Fhir.Model.DocumentReference)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Encounter))
     {
         EncounterSerializer.SerializeEncounter((Hl7.Fhir.Model.Encounter)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.FamilyHistory))
     {
         FamilyHistorySerializer.SerializeFamilyHistory((Hl7.Fhir.Model.FamilyHistory)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Group))
     {
         GroupSerializer.SerializeGroup((Hl7.Fhir.Model.Group)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.ImagingStudy))
     {
         ImagingStudySerializer.SerializeImagingStudy((Hl7.Fhir.Model.ImagingStudy)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Immunization))
     {
         ImmunizationSerializer.SerializeImmunization((Hl7.Fhir.Model.Immunization)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.ImmunizationProfile))
     {
         ImmunizationProfileSerializer.SerializeImmunizationProfile((Hl7.Fhir.Model.ImmunizationProfile)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.List))
     {
         ListSerializer.SerializeList((Hl7.Fhir.Model.List)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Location))
     {
         LocationSerializer.SerializeLocation((Hl7.Fhir.Model.Location)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Media))
     {
         MediaSerializer.SerializeMedia((Hl7.Fhir.Model.Media)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Medication))
     {
         MedicationSerializer.SerializeMedication((Hl7.Fhir.Model.Medication)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.MedicationAdministration))
     {
         MedicationAdministrationSerializer.SerializeMedicationAdministration((Hl7.Fhir.Model.MedicationAdministration)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.MedicationDispense))
     {
         MedicationDispenseSerializer.SerializeMedicationDispense((Hl7.Fhir.Model.MedicationDispense)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.MedicationPrescription))
     {
         MedicationPrescriptionSerializer.SerializeMedicationPrescription((Hl7.Fhir.Model.MedicationPrescription)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.MedicationStatement))
     {
         MedicationStatementSerializer.SerializeMedicationStatement((Hl7.Fhir.Model.MedicationStatement)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Message))
     {
         MessageSerializer.SerializeMessage((Hl7.Fhir.Model.Message)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Observation))
     {
         ObservationSerializer.SerializeObservation((Hl7.Fhir.Model.Observation)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.OperationOutcome))
     {
         OperationOutcomeSerializer.SerializeOperationOutcome((Hl7.Fhir.Model.OperationOutcome)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Order))
     {
         OrderSerializer.SerializeOrder((Hl7.Fhir.Model.Order)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.OrderResponse))
     {
         OrderResponseSerializer.SerializeOrderResponse((Hl7.Fhir.Model.OrderResponse)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Organization))
     {
         OrganizationSerializer.SerializeOrganization((Hl7.Fhir.Model.Organization)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Other))
     {
         OtherSerializer.SerializeOther((Hl7.Fhir.Model.Other)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Patient))
     {
         PatientSerializer.SerializePatient((Hl7.Fhir.Model.Patient)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Practitioner))
     {
         PractitionerSerializer.SerializePractitioner((Hl7.Fhir.Model.Practitioner)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Procedure))
     {
         ProcedureSerializer.SerializeProcedure((Hl7.Fhir.Model.Procedure)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Profile))
     {
         ProfileSerializer.SerializeProfile((Hl7.Fhir.Model.Profile)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Provenance))
     {
         ProvenanceSerializer.SerializeProvenance((Hl7.Fhir.Model.Provenance)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Query))
     {
         QuerySerializer.SerializeQuery((Hl7.Fhir.Model.Query)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Questionnaire))
     {
         QuestionnaireSerializer.SerializeQuestionnaire((Hl7.Fhir.Model.Questionnaire)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.RelatedPerson))
     {
         RelatedPersonSerializer.SerializeRelatedPerson((Hl7.Fhir.Model.RelatedPerson)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.SecurityEvent))
     {
         SecurityEventSerializer.SerializeSecurityEvent((Hl7.Fhir.Model.SecurityEvent)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Specimen))
     {
         SpecimenSerializer.SerializeSpecimen((Hl7.Fhir.Model.Specimen)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Substance))
     {
         SubstanceSerializer.SerializeSubstance((Hl7.Fhir.Model.Substance)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Supply))
     {
         SupplySerializer.SerializeSupply((Hl7.Fhir.Model.Supply)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.ValueSet))
     {
         ValueSetSerializer.SerializeValueSet((Hl7.Fhir.Model.ValueSet)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Binary))
     {
         BinarySerializer.SerializeBinary((Hl7.Fhir.Model.Binary)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.Appointment))
     {
         AppointmentSerializer.SerializeAppointment((Hl7.Fhir.Model.Appointment)value, writer, summary);
     }
     else if (value.GetType() == typeof(Hl7.Fhir.Model.InterestOfCare))
     {
         InterestOfCareSerializer.SerializeInterestOfCare((Hl7.Fhir.Model.InterestOfCare)value, writer, summary);
     }
     else
     {
         throw new Exception("Encountered unknown type " + value.GetType().Name);
     }
 }