     do {
       let results = try context.fetch(request)
       let objects = results as NSArray
-      if let first = objects.firstObject as? [String: Any] {
-        return first[receiverName] as? NSNumber
-      }
-    } catch {
-      
-    }
-    
-    return nil
+      guard let first = objects.firstObject as? [String: Any] else { return nil }
+      return first[receiverName] as? NSNumber
+      
+    } catch {
+      if CoreDuck.printErrors {
+        print("⚠️ failed to fetch request for " + entityName)
+      }
+      return nil
+    }
   }
 }

    // Try to perform fetch request
    do {
      try fetchedResultsController.performFetch()
    } catch {
      
    }
    
    // Return NSFetchedResultsController
    return fetchedResultsController as? NSFetchedResultsController<T>
  }
  
  // MARK: - fetchAll by attribute in context
  
  /**
   Fetch all objects by attribute in context
   
   - parameter byAttribute: name of attribute for search
   - parameter withInt64Value: value for search
   - parameter sortBy: column name for sorting
   - parameter ascending: sorting order
   - parameter inContext: context for search
   - parameter delegate: NSFetchedResultsControllerDelegate
   */
  @available(OSX 10.12, *)
  static func fetchAll<T>(byAttribute attribute: String, withInt64Value value: Int64, sortBy: String, ascending: Bool, inContext context: NSManagedObjectContext, delegate: NSFetchedResultsControllerDelegate) -> NSFetchedResultsController<T>? {
    
    // Build predicate with value
    let predicate = NSPredicate(format: "\(attribute) = \(value)")
    
    // Fetch and return data
    return self.fetchAll(withPredicate: predicate, sortBy: sortBy, ascending: ascending, inContext: context, delegate: delegate)
  }
  
  // MARK: - Aggregate functions
  
  /**
   Sum by attribute
   
   - parameter byAttribute: name of attribute for search
   - parameter withPredicate: predicate for search
   - parameter inContext: context for search
   */
  static func sum(onAttribute attribute: String, withPredicate predicate: NSPredicate, inContext context: NSManagedObjectContext) -> NSNumber? {
    
    // Initialize Fetch Request
    let request: NSFetchRequest<NSFetchRequestResult> = NSFetchRequest(entityName: self.entityName)
    
    // Add Predicate
    request.predicate = predicate
    
    // Set result type

    // Try to perform fetch request
    do {
      try fetchedResultsController.performFetch()
      return fetchedResultsController
      
    } catch {
      if CoreDuck.printErrors {
        print("⚠️ failed to fetch request for " + entityName)
      }
      return nil
    }
  }
  
  /// Fetch all objects with predicate in context
  ///
  /// - Parameters:
  ///   - predicate: NSPredicate for search
  ///   - sortedBy: column name to sort by
  ///   - ascending: direction to sort by
  ///   - delegate: NSFetchedResultsControllerDelegate
  ///   - context: NSManagedObjectContext to fetch request
  /// - Returns: NSFetchedResultsController
  @available(OSX 10.12, *)
  static func fetchAll<T: NSManagedObject>(with predicate: NSPredicate, sortedBy: String, ascending: Bool, delegate: NSFetchedResultsControllerDelegate, in context: NSManagedObjectContext = NSManagedObjectContext.mainContext) -> NSFetchedResultsController<T>? {
    let request: NSFetchRequest<T> = NSFetchRequest(entityName: entityName)
    
    // Sort Descriptors
    let sortDescriptor = NSSortDescriptor(key: sortedBy, ascending: ascending)
    request.sortDescriptors = [sortDescriptor]
    
    // Add Predicate
