public static EnvironmentReference_V2_0 ToEnvironmentReference_V2_0(this IIdentifiable identifiable)
        {
            if (identifiable.Identification == null)
            {
                return(null);
            }

            KeyElements_V2_0 type;

            if (identifiable is IAsset)
            {
                type = KeyElements_V2_0.Asset;
            }
            else if (identifiable is IAssetAdministrationShell)
            {
                type = KeyElements_V2_0.AssetAdministrationShell;
            }
            else if (identifiable is IConceptDescription)
            {
                type = KeyElements_V2_0.ConceptDescription;
            }
            else if (identifiable is ISubmodel)
            {
                type = KeyElements_V2_0.Submodel;
            }
            else
            {
                return(null);
            }

            if (!Enum.TryParse <KeyType_V2_0>(identifiable.Identification.IdType.ToString(), out KeyType_V2_0 idType))
            {
                if (identifiable.Identification.IdType == KeyType.URI)
                {
                    idType = KeyType_V2_0.IRI;
                }
            }

            EnvironmentReference_V2_0 reference = new EnvironmentReference_V2_0()
            {
                Keys = new List <EnvironmentKey_V2_0>()
                {
                    new EnvironmentKey_V2_0()
                    {
                        IdType = idType,
                        Local  = true,
                        Value  = identifiable.Identification.Id,
                        Type   = type
                    }
                }
            };

            return(reference);
        }
        public static Reference <T> ToReference_V2_0 <T>(this EnvironmentReference_V2_0 environmentReference) where T : IReferable
        {
            if (environmentReference == null)
            {
                return(null);
            }

            if (environmentReference?.Keys?.Count > 0)
            {
                return(new Reference <T>(environmentReference.Keys.ConvertAll(c => c.ToKey()).ToArray()));
            }
            return(null);
        }
        public static Reference ToReference_V2_0(this EnvironmentReference_V2_0 environmentReference)
        {
            if (environmentReference == null)
            {
                return(null);
            }

            if (environmentReference?.Keys?.Count > 0)
            {
                return(new Reference(environmentReference.Keys.ConvertAll(c => c.ToKey()).ToArray()));
            }
            return(null);
        }