/// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }

            ((Fhir.R4.Models.BackboneElement) this).SerializeJson(writer, options, false);

            if (GeneSequenceOrigin != null)
            {
                writer.WritePropertyName("geneSequenceOrigin");
                GeneSequenceOrigin.SerializeJson(writer, options);
            }

            if (Gene != null)
            {
                writer.WritePropertyName("gene");
                Gene.SerializeJson(writer, options);
            }

            if ((Source != null) && (Source.Count != 0))
            {
                writer.WritePropertyName("source");
                writer.WriteStartArray();

                foreach (Reference valSource in Source)
                {
                    valSource.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
            public override IDeepCopyable CopyTo(IDeepCopyable other)
            {
                var dest = other as GeneComponent;

                if (dest == null)
                {
                    throw new ArgumentException("Can only copy to an object of the same type", "other");
                }

                base.CopyTo(dest);
                if (GeneSequenceOrigin != null)
                {
                    dest.GeneSequenceOrigin = (Hl7.Fhir.Model.CodeableConcept)GeneSequenceOrigin.DeepCopy();
                }
                if (Gene != null)
                {
                    dest.Gene = (Hl7.Fhir.Model.CodeableConcept)Gene.DeepCopy();
                }
                if (Source != null)
                {
                    dest.Source = new List <Hl7.Fhir.Model.ResourceReference>(Source.DeepCopy());
                }
                return(dest);
            }