private function packageAppFiles($app)
    {
        $appName = $app->name;
        $zipFileName = $this->zipFilePath;
        $storageServiceId = $app->storage_service_id;
        $storageFolder = $app->storage_container;

        if (empty($storageServiceId)) {
            $storageServiceId = $this->getDefaultStorageServiceId();
        }

        if (empty($storageServiceId)) {
            throw new InternalServerErrorException("Can not find storage service identifier.");
        }

        /** @type FileServiceInterface $storage */
        $storage = ServiceManager::getServiceById($storageServiceId);
        if (!$storage) {
            throw new InternalServerErrorException("Can not find storage service by identifier '$storageServiceId''.");
        }

        if ($storage->folderExists($storageFolder)) {
            $storage->getFolderAsZip($storageFolder, $this->zip, $zipFileName, true);
        }

        return true;
    }