public static List <T?> GetMultiSelectValueListForPropertyDef <T>(this ObjVerEx objVerEx, int id, bool include_deleted = false)
            where T : struct
        {
            if (!typeof(T).IsEnum || !objVerEx.HasValue(id))
            {
                return(new List <T?>());
            }

            Lookups lookups = objVerEx.GetLookups(id);

            if (lookups.Count == 0)
            {
                return(null);
            }

            List <T?> Items = new List <T?>();

            foreach (Lookup lookup in lookups)
            {
                if (lookup.Deleted && !include_deleted)
                {
                    continue;
                }
                Items.Add((T)Enum.Parse(typeof(T), lookup.Item.ToString()));
            }

            return(Items);
        }
        public static T GetSingleSelectLookupValueForPropertyDef <T>(this ObjVerEx objVerEx, int property_def_id, bool include_deleted = false)
            where T : IObjVerEx, new()
        {
            if (!objVerEx.HasValue(property_def_id))
            {
                return(default(T));
            }

            Lookup lookup = objVerEx.GetProperty(property_def_id).Value.GetValueAsLookup();

            if (lookup.Deleted && !include_deleted)
            {
                return(default(T));
            }

            ObjVerEx objVEx = new ObjVerEx(objVerEx.Vault, lookup.ObjectType, lookup.Item, lookup.Version);

            return(new T()
            {
                objVerEx = objVEx
            });
        }
        public static List <T> GetMultiSelectLookupValueForPropertyDef <T>(this ObjVerEx objVerEx, int property_def_id, bool include_deleted = false)
            where T : IObjVerEx, new()
        {
            if (!objVerEx.HasValue(property_def_id))             // Direct References Exist
            {
                return(new List <T>());
            }

            List <T> Items   = new List <T>();
            Lookups  lookups = objVerEx.GetProperty(property_def_id).Value.GetValueAsLookups();

            foreach (Lookup lookup in lookups)
            {
                if (lookup.Deleted && !include_deleted)
                {
                    continue;
                }

                ObjVerEx objVEx   = new ObjVerEx(objVerEx.Vault, lookup.ObjectType, lookup.Item, lookup.Version);
                T        classObj = new T()
                {
                    objVerEx = objVEx
                };

                if (null == classObj)
                {
                    continue;
                }

                if (!Items.Contains(classObj))
                {
                    Items.Add(classObj);
                }
            }

            return(Items);
        }