 												  feedTitle: article.sortableName,
 												  articleTitle: ArticleStringFormatter.truncatedTitle(article).isEmpty ? ArticleStringFormatter.truncatedSummary(article) : ArticleStringFormatter.truncatedTitle(article),
 												  articleSummary: article.summary,
-												  feedIcon: article.iconImage()?.image.dataRepresentation(),
+												  feedIconPath: writeImageDataToSharedContainer(article.iconImage()?.image.dataRepresentation()),
 												  pubDate: article.datePublished?.description ?? "")
 				starred.append(latestArticle)
 			}

	private var backgroundTaskID: UIBackgroundTaskIdentifier!
	private lazy var appGroup = Bundle.main.object(forInfoDictionaryKey: "AppGroup") as! String
	private lazy var containerURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroup)
	private lazy var dataURL = containerURL?.appendingPathComponent("widget-data.json")
	
	static let shared = WidgetDataEncoder()
	private init () {}
	
	@available(iOS 14, *)
	func encodeWidgetData() throws {
		os_log(.debug, log: log, "Starting encoding widget data.")
		
		do {

		FileManager.default.fileExists(atPath: dataURL!.path)
	}
	
	private func writeImageDataToSharedContainer(_ imageData: Data?) -> String? {
		if imageData == nil { return nil }
		// Each image gets a UUID
		let uuid = UUID().uuidString
		if let imagePath = imageContainer?.appendingPathComponent(uuid, isDirectory: false) {
			do {
				try imageData!.write(to: imagePath)
				return imagePath.path
			} catch {
				return nil
			}
		}
		
		return nil
	}
	
	private func flushSharedContainer() {
		if let imageContainer = imageContainer {
			try? FileManager.default.removeItem(atPath: imageContainer.path)
			try? FileManager.default.createDirectory(at: imageContainer, withIntermediateDirectories: true, attributes: nil)
		}
	}
	
}

