 extension Coolie.Value {
 
     func generateClass(fromLevel level: Int = 0, modelName: String? = nil, argumentLabel: String? = nil, jsonDictionaryName: String? = nil, debug: Bool, into string: inout String) {
-        func indentLevel(_ level: Int) {
-            for _ in 0..<level {
-                string += "\t"
-            }
-        }
         let jsonDictionaryName = jsonDictionaryName ?? "[String: Any]"
         switch self {
         case .bool, .number, .string, .url, .null:
             break
         case .dictionary(let info):
             // struct name
-            indentLevel(level)
+            indent(with: level, into: &string)
             string += "class \(modelName ?? "Model") {\n"
             // properties
             for key in info.keys.sorted() {
                 if let value = info[key] {
                     if value.isDictionaryOrArray {
                         value.generateClass(fromLevel: level + 1, modelName: key.capitalized, argumentLabel: argumentLabel, jsonDictionaryName: jsonDictionaryName, debug: debug, into: &string)
-                        indentLevel(level + 1)
+                        indent(with: level + 1, into: &string)
                         if value.isArray {
                             if case .array(_, let values) = value, let unionValue = unionValues(values) {
                                 if case .null(let optionalValue) = unionValue {

                if let value = info[key] {
                    if value.isDictionaryOrArray {
                        if value.isDictionary {
                            indentLevel(level + 2)
                            string += "guard let \(key.coolie_lowerCamelCase)JSONDictionary = info[\"\(key)\"] as? \(jsonDictionaryName) else { "
                            string += debug ? "print(\"Not found dictionary: \(key)\"); return nil }\n" : "return nil }\n"
                            indentLevel(level + 2)
                            string += "guard let \(key.coolie_lowerCamelCase) = \(key.capitalized)(\(trueArgumentLabel)\(key.coolie_lowerCamelCase)JSONDictionary) else { "
                            string += debug ? "print(\"Failed to generate: \(key.coolie_lowerCamelCase)\"); return nil }\n" : "return nil }\n"
                        } else if value.isArray {

                }
            }
            for key in info.keys.sorted() {
                indent(with: level + 2, into: &string)
                let property = key.coolie_lowerCamelCase
                string += "self.\(property) = \(property)\n"
            }
            indent(with: level + 1, into: &string)
            string += "}\n"
            indent(with: level, into: &string)
            string += "}\n"
        case .array(let name, let values):
            if let unionValue = unionValues(values) {
