     }
     
     public func delete(readingLists: [ReadingList]) throws {
-        
-        let moc = dataStore.viewContext
         let readingListsToDeleteRequest: NSFetchRequest<ReadingList> = ReadingList.fetchRequest()
-        
         let names = readingLists.flatMap({ $0.name })
         readingListsToDeleteRequest.predicate = NSPredicate(format: "name IN %@", names)
-        
         let readingListsToDelete = try moc.fetch(readingListsToDeleteRequest)
         
         for readingList in readingListsToDelete {

public class ReadingListsController: NSObject {
    fileprivate weak var dataStore: MWKDataStore!
    fileprivate let apiController = ReadingListsAPIController()
    
    @objc init(dataStore: MWKDataStore) {
        self.dataStore = dataStore
        super.init()
    }
    

        return readingList
    }
    
    
    /// Fetches n articles with lead images for a given reading list.
    ///
    /// - Parameters:
    ///   - readingList: reading list that the articles belong to.
    ///   - limit: number of articles with lead images to fetch.
    /// - Returns: array of articles with lead images.
    public func articlesWithLeadImages(for readingList: ReadingList, limit: Int) throws -> [WMFArticle] {
        assert(Thread.isMainThread)
        let request: NSFetchRequest<ReadingListEntry> = ReadingListEntry.fetchRequest()
        request.predicate = NSPredicate(format: "list == %@ && article.imageURLString != NULL", readingList)
        request.fetchLimit = limit
        return (try moc.fetch(request)).flatMap { $0.article }
    }
    
}
