protected static function fieldCompare(Document $a, Document $b) {
        $field = self::$orderByField;
        if (property_exists('\CloudControl\Cms\storage\entities\Document', $field)) {
            return strcasecmp($a->{$field}, $b->{$field});
        }

        if (!isset($a->fields->{$field}[0])) {
            return -3;
        }

        if (!isset($b->fields->{$field}[0])) {
            return 3;
        }

        return strcasecmp($a->fields->{$field}[0], $b->fields->{$field}[0]);
    }