code: function(model) {
      var fields = _.keys(model);
      var updated = {};
  
      _.each(fields, function(field) {
          var updatedField = {};
          var modelField = {};
          if (!(field === Object(field))) {
              updatedField.field = field;
              if (!(model[field] === Object(model[field]))) {
                  modelField = { type: model[field] };
              } else {
                  modelField = model[field];
              }
              updatedField = _.defaults(updatedField, modelField);
          } else {
              updatedField = field;
          }
          updated[updatedField.field] = updatedField;
      });
  
      return updated;
  }
docs: convert model and merge with nga fields