private int Count(SQLServerVisitor <T> visitor)
        {
            IEnumerable <Parameter> parameters;
            var sql = BuildQuerySQL(visitor, out parameters);

            if (visitor.Skip != 0)
            {
                string orderBy = "Id DESC";
                if (visitor.OrderClauses != null && visitor.OrderClauses.Count() > 0)
                {
                    orderBy = ToOrderString(visitor);
                }

                sql = string.Format(@"SELECT * 
                    FROM (
                        SELECT *,ROW_NUMBER() OVER(ORDER BY {0}) AS RowIndex
                            FROM ({1})content
                         )paging
                    WHERE (RowIndex > {2})", orderBy, sql, visitor.Skip);
            }
            sql = string.Format("SELECT COUNT(Id) FROM ({0})T", sql);

            var command = BuildCommand(sql, parameters);

            return((int)SQLServerHelper.ExecuteScalar(ContentQuery.Repository, command));
        }