public function getSortedNodesBuilder($key = null, $direction = null, $type = null, $limit = null, $locale = null)
    {
        $builder = PublishedNode::translatedIn($locale)
            ->groupBy('nodes.id');

        if ($type)
        {
            $builder->withType($type);
        }

        if ($limit)
        {
            $builder->limit($limit);
        }

        return $builder->sortable($key, $direction);
    }