public static string CleanName(string value, bool useKeywordRenameAlias, bool preserveNaming = false)
        {
            if (String.IsNullOrEmpty(value))
            {
                return(String.Empty);
            }

            if (preserveNaming)
            {
                value = CleanEscapeSystemType(value);
            }

            // Lookup in mapping file for overrides.
            if (useKeywordRenameAlias && KeywordRenameAlias.ContainsKey(value))
            {
                // TODO: Add ToSpacedWords Support and check each value.
                return(KeywordRenameAlias[value, value]);
            }

            if (Configuration.Instance.CleanExpressions.Count > 0)
            {
                foreach (Regex regex in Configuration.Instance.CleanExpressions)
                {
                    if (regex.IsMatch(value))
                    {
                        value = regex.Replace(value, String.Empty);
                        break;
                    }
                }
            }

            string result = _cleanNumberPrefix.Replace(value, String.Empty, 1).Trim();

            // If a column's name is 123, then this will ensure that the name is valid by making the name Member123.
            if (String.IsNullOrEmpty(result))
            {
                result = String.Concat(Configuration.Instance.SingularMemberSuffix, value);
            }
            else if (result.Equals("."))
            {
                result = "Period";
            }
            else if (result.Equals("'"))
            {
                result = "Apostrophe";
            }
            else if (result.Equals("_"))
            {
                result = "Underscore";
            }

            // If the result is empty then the name only contained numbers. If this is true then prefix the column.
            return(!String.IsNullOrEmpty(result) ? result : String.Concat(Configuration.Instance.SingularMemberSuffix, value));
        }
        /// <summary>
        /// Validates the entity name.
        /// </summary>
        /// <returns>Returns properly formatted class name based off the name of the table.</returns>
        public static string ValidateName(IEntity entity)
        {
            bool   useKeywordRenameAlias = false;
            string className             = entity.EntityKeyName;

            object value;

            if (entity.ExtendedProperties.TryGetValue(Configuration.Instance.AliasExtendedProperty, out value))
            {
                className = value.ToString();
            }
            else if (KeywordRenameAlias.ContainsKey(className))
            {
                className = KeywordRenameAlias[className];
            }
            else
            {
                useKeywordRenameAlias = true;

                if (!String.IsNullOrEmpty(Configuration.Instance.TablePrefix) && className.StartsWith(Configuration.Instance.TablePrefix))
                {
                    className = className.Remove(0, Configuration.Instance.TablePrefix.Length);
                }

                if (Configuration.Instance.NamingProperty.EntityNaming == EntityNaming.Plural)
                {
                    className = StringUtil.ToPascalCase(StringUtil.ToPlural(className));
                }
                else if (Configuration.Instance.NamingProperty.EntityNaming == EntityNaming.Singular)
                {
                    className = StringUtil.ToSingular(className);
                }
            }

            return(PropertyName(className, useKeywordRenameAlias, Configuration.Instance.NamingProperty.EntityNaming == EntityNaming.Preserve));
        }