(NSPredicate *)predicateFromDictionary:(NSDictionary *)dict
{
    NSArray *subpredicates = [dict map:id (^)(id key, id value) {
        return [NSPredicate predicateWithFormat:@"%K == %@", key, value];
    }

    return [NSCompoundPredicate andPredicateWithSubpredicates:subpredicates];
}