     }
     internal class func isValid(array: [AnyObject], for type: MappingType) -> Bool {
         for value in array {
-            if !isValid(property: value, for: type) {
-                return false
-            }
+            if !isValid(property: value, for: type) { return false }
         }
         return true
+    }
+    internal class func handleForNilValue(isOptional: Bool) throws {
+        if !isOptional { throw MapperError.notFound }
     }
 }
 

    //Detecting last level of JSON Tree
    internal class func isContainsOnlyAtomaryValues(_ json: AnyObject) -> Bool {
        var nodesToCheck = [AnyObject]()
        if let jsonDictionary = json as? [String: AnyObject] {
            nodesToCheck = jsonDictionary.values.map {$0 as AnyObject}
        }
        if let jsonArray = json as? [AnyObject] {
            nodesToCheck = jsonArray
        }
        for node in nodesToCheck {
            if node is Dictionary<String, Any> || node is Array<Any> { return false }
        }

        }
        object.map(with: Wrapping(propertyDictionary))
    }
}
//MARK: - Helpers 
extension Mapper {
    internal class func searchType(for path: [MapPathable]) throws -> MapperSearchType {
        if path.isEmpty {
            return .recursive
        }
        let isContainsTargetPaths = path.contains { (path) -> Bool in
            switch path {
            case .target:
                return true
            default:
                return false
            }
        }
        let isContainsDestination = path.contains { (path) -> Bool in
            switch path {
            case .destination:
                return true
            default:
                return false
            }
        }
        let isContainsNone  = path.contains { (path) -> Bool in
            switch path {
            case .none:
                return true
            default:
                return false
            }
        }
        if isContainsNone {
            if isContainsTargetPaths || isContainsDestination {
                throw MapperError.wrongFormat
            }
            return .recursive
        }
        if isContainsTargetPaths {
            if isContainsDestination {
                return .determined
            } else {
                throw MapperError.wrongFormat
            }
        }
        if isContainsDestination {
            if !isContainsTargetPaths {
                return .recursiveWithDestination
            }
        }
        return .determined
    }
}

