protected static function deleteHostedAppStorage($id, $storageServiceId, $storageFolder)
    {
        $app = AppModel::whereId($id)->first();

        if (empty($app) && !empty($storageServiceId) && !empty($storageFolder)) {
            /** @type FileServiceInterface $storageService */
            $storageService = ServiceManager::getServiceById($storageServiceId);

            if ($storageService->folderExists($storageFolder)) {
                $storageService->deleteFolder($storageFolder, true);
            }
        }
    }