def METHOD_NAME(repositoryUrl, catalogName, catalogDirectory, beVerbose, getHistory):
	catalogs = [catalogName]
	downloads = 0
	while catalogs:
		catalog = catalogs.pop(0)
		if os.path.exists(getCatalogFilePath(catalog, catalogDirectory)):
			if beVerbose:
				print "--> skipping already loaded catalog:" , catalog
			continue
		downloadCatalog(repositoryUrl, catalog, catalogDirectory, beVerbose)
		nestedCatalogs = findNestedCatalogs(catalog, catalogDirectory, getHistory)
		downloads += 1
		if beVerbose:
			print "--> found" , len(nestedCatalogs) , "catalog references |" , len(catalogs) , "in queue"
			catalogs.extend(nestedCatalogs)
	return downloads