public static void SetContactValue(this OpenHR001Person person, vocContactType contactType, string value)
        {
            dtContact contact = (person.contact ?? new dtContact[] { }).FirstOrDefault(t => t.contactType == contactType);

            if (!string.IsNullOrEmpty(value))
            {
                if (contact == null)
                {
                    contact = new dtContact()
                    {
                        contactType = contactType,
                        updateMode  = vocUpdateMode.add,
                        id          = Guid.NewGuid().ToString()
                    };

                    person.contact = (person.contact ?? new dtContact[] { })
                                     .Concat(new dtContact[] { contact })
                                     .ToArray();
                }

                contact.value = value;
            }
            else
            {
                if (contact != null)
                {
                    person.contact = person.contact
                                     .Where(t => t != contact)
                                     .ToArray();
                }
            }
        }
        public static string FormatContactValue(vocContactType contactType, string value)
        {
            switch (contactType)
            {
            case vocContactType.H:
            case vocContactType.W:
            case vocContactType.M: return(FormatPhoneNumber(value));

            default: return(value);
            }
        }
        public static string GetFormattedContactValue(this dtContact[] contacts, vocContactType contactType)
        {
            if (contacts == null)
            {
                return(null);
            }

            dtContact contact = contacts.FirstOrDefault(t => t.contactType == contactType);

            if (contact == null)
            {
                return(string.Empty);
            }

            if (string.IsNullOrEmpty(contact.value))
            {
                return(string.Empty);
            }

            return(FormatContactValue(contactType, contact.value));
        }
        public static string GetContactValueWithPrefixedDescription(this dtContact[] contacts, vocContactType contactType)
        {
            string contactValue = GetFormattedContactValue(contacts, contactType);

            if (string.IsNullOrEmpty(contactValue))
            {
                return(string.Empty);
            }

            return(contactType.ToString().ToUpper() + ": " + contactValue);
        }