private function buildSortRecursive(ApiInterface $entity, $parts, $isAsc, &$orderBy, $alias = null) {
        if(is_null($alias)) {
            $alias = get_class($entity);
        }
        $part = array_shift($parts);
        if(sizeOf($parts) == 0) { //Is Last part
            if(in_array($part, $entity->getModelsMetaData()->getColumnMap($entity))) {
                if($orderBy != '') {
                    $orderBy .= ',';
                }
                $orderBy .= $alias . '.' . $part . ' ' . ($isAsc ? 'ASC' : 'DESC');
            } else {
                throw new Exception('Could Not Find sort part: ' . $part, 400);
            }
        } else {
            $subAlias = ucfirst($part);
            $subEntity = $this->addJoin($entity, $subAlias, true); //Throws an exception if not found
            $this->buildSortRecursive($subEntity, $parts, $isAsc, $orderBy, $subAlias);
        }
    }