public static void SerializeImmunizationProfileRecommendationProtocolComponent(Hl7.Fhir.Model.ImmunizationProfile.ImmunizationProfileRecommendationProtocolComponent 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 doseSequence
            if (value.DoseSequenceElement != null)
            {
                writer.WriteStartElement("doseSequence");
                IntegerSerializer.SerializeInteger(value.DoseSequenceElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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


            writer.WriteEndComplexContent();
        }
        /// <summary>
        /// Parse ImmunizationProfileRecommendationProtocolComponent
        /// </summary>
        public static Hl7.Fhir.Model.ImmunizationProfile.ImmunizationProfileRecommendationProtocolComponent ParseImmunizationProfileRecommendationProtocolComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.ImmunizationProfile.ImmunizationProfileRecommendationProtocolComponent existingInstance = null)
        {
            Hl7.Fhir.Model.ImmunizationProfile.ImmunizationProfileRecommendationProtocolComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.ImmunizationProfile.ImmunizationProfileRecommendationProtocolComponent();
            string currentElementName = reader.CurrentElementName;

            reader.EnterElement();

            while (reader.HasMoreElements())
            {
                var atName = reader.CurrentElementName;
                // Parse element extension
                if (atName == "extension")
                {
                    result.Extension = new List <Hl7.Fhir.Model.Extension>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "extension"))
                    {
                        result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element _id
                else if (atName == "_id")
                {
                    result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));
                }

                // Parse element doseSequence
                else if (atName == "doseSequence")
                {
                    result.DoseSequenceElement = IntegerParser.ParseInteger(reader, errors);
                }

                // Parse element description
                else if (atName == "description")
                {
                    result.DescriptionElement = FhirStringParser.ParseFhirString(reader, errors);
                }

                // Parse element authority
                else if (atName == "authority")
                {
                    result.Authority = ResourceReferenceParser.ParseResourceReference(reader, errors);
                }

                // Parse element series
                else if (atName == "series")
                {
                    result.SeriesElement = FhirStringParser.ParseFhirString(reader, errors);
                }

                else
                {
                    errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader);
                    reader.SkipSubElementsFor(currentElementName);
                    result = null;
                }
            }

            reader.LeaveElement();
            return(result);
        }