 			folder?.externalID = record.externalID
 		}
 		
-		if let folder = folder, let containerExternalID = folder.externalID, let unclaimedWebFeeds = unclaimedWebFeeds[containerExternalID] {
-			for unclaimedWebFeed in unclaimedWebFeeds {
-				createWebFeedIfNecessary(url: unclaimedWebFeed.url,
-										 name: unclaimedWebFeed.name,
-										 editedName: unclaimedWebFeed.editedName,
-										 homePageURL: unclaimedWebFeed.homePageURL,
-										 webFeedExternalID: unclaimedWebFeed.webFeedExternalID,
+		guard let folder = folder, let containerExternalID = folder.externalID else { return }
+		
+		if let newUnclaimedWebFeeds = newUnclaimedWebFeeds[containerExternalID] {
+			for newUnclaimedWebFeed in newUnclaimedWebFeeds {
+				createWebFeedIfNecessary(url: newUnclaimedWebFeed.url,
+										 name: newUnclaimedWebFeed.name,
+										 editedName: newUnclaimedWebFeed.editedName,
+										 homePageURL: newUnclaimedWebFeed.homePageURL,
+										 webFeedExternalID: newUnclaimedWebFeed.webFeedExternalID,
 										 container: folder)
 			}
 
-			self.unclaimedWebFeeds.removeValue(forKey: containerExternalID)
-		}
-		
+			self.newUnclaimedWebFeeds.removeValue(forKey: containerExternalID)
+		}
+		
+		if let existingUnclaimedWebFeeds = existingUnclaimedWebFeeds[containerExternalID] {
+			for existingUnclaimedWebFeed in existingUnclaimedWebFeeds {
+				folder.addWebFeed(existingUnclaimedWebFeed)
+			}
+			self.existingUnclaimedWebFeeds.removeValue(forKey: containerExternalID)
+		}
 	}
 	
 	func removeContainer(_ externalID: String) {

class CloudKitAcountZoneDelegate: CloudKitZoneDelegate {
	
	private typealias UnclaimedWebFeed = (url: URL, name: String?, editedName: String?, homePageURL: String?, webFeedExternalID: String)
	private var unclaimedWebFeeds = [String: [UnclaimedWebFeed]]()
	
	private var log = OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "CloudKit")

	weak var account: Account?

		container.addWebFeed(webFeed)
	}
	
	func addNewUnclaimedWebFeed(url: URL, name: String?, editedName: String?, homePageURL: String?, webFeedExternalID: String, containerExternalID: String) {
		if var unclaimedWebFeeds = self.newUnclaimedWebFeeds[containerExternalID] {
			unclaimedWebFeeds.append(UnclaimedWebFeed(url: url, name: name, editedName: editedName, homePageURL: homePageURL, webFeedExternalID: webFeedExternalID))
			self.newUnclaimedWebFeeds[containerExternalID] = unclaimedWebFeeds
		} else {
			var unclaimedWebFeeds = [UnclaimedWebFeed]()
			unclaimedWebFeeds.append(UnclaimedWebFeed(url: url, name: name, editedName: editedName, homePageURL: homePageURL, webFeedExternalID: webFeedExternalID))
			self.newUnclaimedWebFeeds[containerExternalID] = unclaimedWebFeeds
		}
	}
	
	func addExistingUnclaimedWebFeed(_ webFeed: WebFeed, containerExternalID: String) {
		if var unclaimedWebFeeds = self.existingUnclaimedWebFeeds[containerExternalID] {
			unclaimedWebFeeds.append(webFeed)
			self.existingUnclaimedWebFeeds[containerExternalID] = unclaimedWebFeeds
		} else {
			var unclaimedWebFeeds = [WebFeed]()
			unclaimedWebFeeds.append(webFeed)
			self.existingUnclaimedWebFeeds[containerExternalID] = unclaimedWebFeeds
		}
	}
	
