public AuditQueryMessageParticipantObject(string sopClassUid, DicomAttributeCollection msg)
        {
            ParticipantObjectTypeCode         = ParticipantObjectTypeCodeEnum.SystemObject;
            ParticipantObjectTypeCodeRole     = ParticipantObjectTypeCodeRoleEnum.Report;
            ParticipantObjectIdTypeCodedValue = ParticipantObjectIDTypeCode.ClassUID;
            ParticipantObjectId     = sopClassUid;
            ParticipantObjectDetail = new ParticipantObjectDetail()
            {
                type  = "TransferSyntax",
                value = System.Text.Encoding.ASCII.GetBytes(TransferSyntax.ExplicitVrLittleEndianUid)
            };

            MemoryStream      ms     = new MemoryStream();
            DicomStreamWriter writer = new DicomStreamWriter(ms)
            {
                TransferSyntax = TransferSyntax.ExplicitVrLittleEndian
            };

            writer.Write(TransferSyntax.ExplicitVrLittleEndian, msg, DicomWriteOptions.Default);

            ParticipantObjectQuery = ms.ToArray();

            ParticipantObjectDetailString = CreateDetailsString(msg);
        }
        public ParticipantObjectIdentificationContents(AuditParticipantObject item)
        {
            if (item.ParticipantObjectTypeCode.HasValue)
            {
                ParticipantObjectTypeCode          = (ParticipantObjectIdentificationContentsParticipantObjectTypeCode)item.ParticipantObjectTypeCode.Value;
                ParticipantObjectTypeCodeSpecified = true;
            }
            else
            {
                ParticipantObjectTypeCodeSpecified = false;
            }

            if (item.ParticipantObjectTypeCodeRole.HasValue)
            {
                ParticipantObjectTypeCodeRole          = (ParticipantObjectIdentificationContentsParticipantObjectTypeCodeRole)item.ParticipantObjectTypeCodeRole.Value;
                ParticipantObjectTypeCodeRoleSpecified = true;
            }
            else
            {
                ParticipantObjectTypeCodeRoleSpecified = false;
            }

            if (item.ParticipantObjectDataLifeCycle.HasValue)
            {
                ParticipantObjectDataLifeCycle          = (ParticipantObjectIdentificationContentsParticipantObjectDataLifeCycle)item.ParticipantObjectDataLifeCycle.Value;
                ParticipantObjectDataLifeCycleSpecified = true;
            }
            else
            {
                ParticipantObjectDataLifeCycleSpecified = false;
            }

            if (item.ParticipantObjectIdTypeCode.HasValue)
            {
                ParticipantObjectIDTypeCode =
                    new ParticipantObjectIDTypeCode(item.ParticipantObjectIdTypeCode.Value);
            }
            else if (item.ParticipantObjectIdTypeCodedValue != null)
            {
                ParticipantObjectIDTypeCode =
                    new ParticipantObjectIDTypeCode(item.ParticipantObjectIdTypeCodedValue);
            }

            if (item.ParticipantObjectDetail != null)
            {
                ParticipantObjectDetail = new[] { item.ParticipantObjectDetail }
            }
            ;

            if (!string.IsNullOrEmpty(item.ParticipantObjectDetailString))
            {
                ParticipantObjectDetail = new ParticipantObjectDetail[] { new ParticipantObjectDetail()
                                                                          {
                                                                              type = item.ParticipantObjectDetailString
                                                                          } };
            }

            if (!string.IsNullOrEmpty(item.ParticipantObjectId))
            {
                ParticipantObjectID = item.ParticipantObjectId;
            }

            if (!string.IsNullOrEmpty(item.ParticipantObjectName))
            {
                Item = item.ParticipantObjectName;
            }

            if (item.ParticipantObjectQuery != null)
            {
                Item = item.ParticipantObjectQuery;
            }

            if (!String.IsNullOrEmpty(item.AccessionNumber))
            {
                Accession = new[] { new ParticipantObjectDescriptionTypeAccession(item.AccessionNumber) }
            }
            ;
            if (!String.IsNullOrEmpty(item.MppsUid))
            {
                MPPS = new[] { new ParticipantObjectDescriptionTypeMPPS(item.MppsUid) }
            }
            ;

            if (item.SopClassDictionary != null && item.SopClassDictionary.Count > 0)
            {
                // TODO: right now the schema only allows one SOP Class. It nees to be fixed.
                var sopClass = CollectionUtils.FirstElement(item.SopClassDictionary.Values);
                SOPClass = new ParticipantObjectDescriptionTypeSOPClass(sopClass.UID, sopClass.NumberOfInstances);
            }
        }
    }