private string GetSqlCommandSelect(int contentId)
        {
            string select = null;

            if (!string.IsNullOrEmpty(Fields))
            {
                var orderBy      = GetSqlCommandOrderBy();
                var orderByAttrs = string.IsNullOrEmpty(orderBy)
                    ? new string[] { }
                    : orderBy
                .Split(',')
                .Select(n => n.Trim())
                .Select(n => CRegex.Replace(AscRegex.Replace(DescRegex.Replace(n, ""), ""), ""))
                .Select(n => n.Trim().Replace("[", "").Replace("]", ""))
                .ToArray();

                var attrs = new HashSet <string>(
                    DbConnector.GetContentAttributeObjects(contentId)
                    .Select(n => n.Name.ToLowerInvariant())
                    .Union(new[] { "content_item_id", "archive", "visible", "created", "modified", "last_modified_by" })
                    );

                select = string.Join(", ", Fields
                                     .Split(',')
                                     .Select(n => n.Trim().Replace("[", "").Replace("]", ""))
                                     .Union(orderByAttrs, StringComparer.InvariantCultureIgnoreCase)
                                     .Where(n => attrs.Contains(n.ToLowerInvariant()))
                                     .Select(n => SqlQuerySyntaxHelper.FieldName(DbConnector.DatabaseType, n))
                                     .ToArray()
                                     );
            }

            if (string.IsNullOrEmpty(select))
            {
                select = "c.*";
            }

            if (UseSecurity && !FilterRecords)
            {
                select += ", IsNull(pi.permission_level, 0) as current_permission_level ";
            }

            return(select);
        }