/// <summary>
        /// Determines whether the specified service is active.
        /// </summary>
        /// <param name="service">The service.</param>
        /// <param name="entityId">The entity identifier.</param>
        /// <returns></returns>
        public static bool?IsActive(IOrganizationService service, Guid entityId)
        {
            var info   = new ActivePropertyInfo <T>();
            var entity = service.GetEntity <T>(entityId, new ColumnSet(info.AttributeName));

            return(IsActive(info, entity));
        }
        /// <summary>
        /// Determines whether the specified information is active.
        /// </summary>
        /// <param name="info">The information.</param>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        /// <exception cref="System.Exception">ActivePropertyInfo defines Attribute StateCode, but neither ActiveState or NotActiveState is popualted</exception>
        /// <exception cref="EnumCaseUndefinedException{ActiveAttributeType}"></exception>
        protected static bool?IsActive(ActivePropertyInfo <T> info, T entity)
        {
            bool?active;

            switch (info.ActiveAttribute)
            {
            case ActiveAttributeType.None:
                // Unable to determine
                active = null;
                break;

            case ActiveAttributeType.IsDisabled:
                active = !entity.GetAttributeValue <bool>(info.AttributeName);
                break;

            case ActiveAttributeType.StateCode:
                var state = entity.GetAttributeValue <OptionSetValue>(info.AttributeName).Value;
                if (info.ActiveState.HasValue)
                {
                    active = state == info.ActiveState;
                }
                else if (info.NotActiveState.HasValue)
                {
                    active = state != info.NotActiveState;
                }
                else
                {
                    throw new Exception("ActivePropertyInfo defines Attribute StateCode, but neither ActiveState or NotActiveState is popualted");
                }
                break;

            default:
                throw new EnumCaseUndefinedException <ActiveAttributeType>(info.ActiveAttribute);
            }

            return(active);
        }