/// <summary>
        /// Determines whether the specified object property value is ok.
        /// </summary>
        /// <param name="ObjectPropertyValue">The object property value.</param>
        /// <param name="Operator">The operator.</param>
        /// <param name="UserValue">The user value.</param>
        /// <returns>
        ///     <c>true</c> if the specified object property value is ok; otherwise, <c>false</c>.
        /// </returns>
        private bool IsOk(object ObjectPropertyValue, string Operator, string UserValue)
        {
            bool Rt = false;

            //Type of the property value
            if (ObjectPropertyValue == null)
            {
                return(false);
            }

            Type   TypeOfValue = ObjectPropertyValue.GetType();
            Object FilterValue = CorrectUserValue(UserValue);

            if (Operator.ToUpper().Equals("IN"))
            {
                try
                {
                    string[] fvalue = FilterValue.ToString().Substring(1, FilterValue.ToString().Length - 2).Split(',');
                    object[] values = new object[fvalue.Length];
                    if (TypeOfValue == typeof(int))
                    {
                        for (int i = 0; i < fvalue.Length; i++)
                        {
                            values[i] = int.Parse(fvalue[i]);
                        }
                    }
                    else if (TypeOfValue == typeof(string))
                    {
                        for (int i = 0; i < fvalue.Length; i++)
                        {
                            values[i] = fvalue[i];
                        }
                    }
                    else if (TypeOfValue == typeof(long))
                    {
                        for (int i = 0; i < fvalue.Length; i++)
                        {
                            values[i] = long.Parse(fvalue[i]);
                        }
                    }
                    if (values.Length > 0)
                    {
                        Rt = IsOk(ObjectPropertyValue, Operator, values);
                    }
                    else
                    {
                        throw new NotSupportedException("IN operator Filtering is not possible on the type " + TypeOfValue.ToString() + ". Please use integer or long values.");
                    }
                }
                catch (Exception ex) { throw new InvalidFilterCriteriaException("Invalid IN Filter value", ex); }
            }
            else if (TypeOfValue == typeof(string))
            {
                Rt = IsOk((string)ObjectPropertyValue, Operator, (string)FilterValue);
            }
            else if (TypeOfValue == typeof(int))
            {
                int o;
                if (int.TryParse(FilterValue.ToString(), out o))
                {
                    Rt = IsOk((int)ObjectPropertyValue, Operator, o);
                }
                else
                {
                    Rt = false;
                }
            }
            else if (TypeOfValue == typeof(double))
            {
                double o;
                if (double.TryParse(FilterValue.ToString(), out o))
                {
                    Rt = IsOk((double)ObjectPropertyValue, Operator, o);
                }
                else
                {
                    Rt = false;
                }
            }
            else if (TypeOfValue == typeof(decimal))
            {
                decimal o;
                if (decimal.TryParse(FilterValue.ToString(), out o))
                {
                    Rt = IsOk((decimal)ObjectPropertyValue, Operator, o);
                }
                else
                {
                    Rt = false;
                }
            }
            else if (TypeOfValue == typeof(DateTime))
            {
                DateTime o;
                if (DateTime.TryParse(FilterValue.ToString(), out o))
                {
                    Rt = IsOk((DateTime)ObjectPropertyValue, Operator, o);
                }
                else
                {
                    Rt = false;
                }
            }
            else if (TypeOfValue == typeof(bool))
            {
                bool o;
                if (bool.TryParse(FilterValue.ToString(), out o))
                {
                    Rt = IsOk((bool)ObjectPropertyValue, Operator, o);
                }
                else
                {
                    Rt = false;
                }
            }
            else if (TypeOfValue == typeof(Guid))
            {
                Guid o;
                if (EntityUtil.GuidTryParse(FilterValue.ToString(), out o))
                {
                    Rt = IsOk((Guid)ObjectPropertyValue, Operator, o);
                }
                else
                {
                    Rt = false;
                }
            }
            else if (TypeOfValue == typeof(byte))
            {
                byte o;
                if (byte.TryParse(FilterValue.ToString(), out o))
                {
                    Rt = IsOk((byte)ObjectPropertyValue, Operator, o);
                }
                else
                {
                    Rt = false;
                }
            }
            else if (TypeOfValue == typeof(long))
            {
                long o;
                if (long.TryParse(FilterValue.ToString(), out o))
                {
                    Rt = IsOk((long)ObjectPropertyValue, Operator, o);
                }
                else
                {
                    Rt = false;
                }
            }
            else if (TypeOfValue == typeof(short))
            {
                short o;
                if (short.TryParse(FilterValue.ToString(), out o))
                {
                    Rt = IsOk((short)ObjectPropertyValue, Operator, o);
                }
                else
                {
                    Rt = false;
                }
            }
            else
            {
                throw new Exception("Filtering is not possible on the type " + TypeOfValue.ToString());
            }
            return(Rt);
        }
        /// <summary>
        /// Gets the value of the property with the specified name and returns
        /// it as a collection of objects.
        /// </summary>
        /// <param name="entity">An object instance.</param>
        /// <param name="propertyName">The property name.</param>
        /// <returns>A collection of objects.</returns>
        public static IList GetEntityList(Object entity, String propertyName)
        {
            Object list = EntityUtil.GetPropertyValue(entity, propertyName);

            return(GetEntityList(list));
        }