public static function getUnassignedBlockTypes($includeInternalBlockTypes = false)
    {
        $result = [];
        $app = Application::getFacadeApplication();
        $db = $app->make(Connection::class);
        $rs = $db->executeQuery(<<<EOT
select BlockTypes.btID
from BlockTypes
left join BlockTypeSetBlockTypes on BlockTypes.btID = BlockTypeSetBlockTypes.btID
left join BlockTypeSets on BlockTypeSetBlockTypes.btsID = BlockTypeSets.btsID
where BlockTypeSets.btsID is null
order by BlockTypes.btDisplayOrder asc
EOT
        );
        while (($btID = $rs->fetchColumn()) !== false) {
            $bt = BlockType::getByID($btID);
            if ($bt !== null) {
                if ($includeInternalBlockTypes || !$bt->isBlockTypeInternal()) {
                    $result[] = $bt;
                }
            }
        }

        return $result;
    }