         let mailBox: POSMailbox = self.fetchedResultsController.objectAtIndexPath(indexPath) as POSMailbox
         cell.textLabel?.text = mailBox.name
     }
-
+    
+    // convenience method for fetching objects at index path from the database
+    func managedObjectAtIndexPath(indexPath: NSIndexPath) -> NSManagedObject{
+        return self.fetchedResultsController.objectAtIndexPath(indexPath) as NSManagedObject
+    }
+    
     // MARK: - NSFetchedResultsControllerDelegate
     
     func controllerWillChangeContent(controller: NSFetchedResultsController) {

    // MARK: - Class initialiser
    
    init(asDataSourceForTableView tableView: UITableView){
        self.tableView = tableView
        super.init()
        tableView.dataSource = self

        } else {
            return 0
        }
    }
    
    // Set number of rows in section
    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        
        let sectionInfo = self.fetchedResultsController.sections![section] as NSFetchedResultsSectionInfo
            return sectionInfo.numberOfObjects
    }

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell:UITableViewCell = tableView.dequeueReusableCellWithIdentifier("mailboxCell", forIndexPath: indexPath)as UITableViewCell
        self.configureCell(cell, atIndexPath: indexPath)
        
