       # Form doc is the full set of fields which the doc supports. We must avoid creating modifiers
       # containing any other fields, since this form does not affect them.
       keys = _.keys(formDoc)
-      changes = {}
-      _.each keys, (key) ->
-        formValue = Forms._sanitizeCompareValue(formDoc[key])
-        prevValue = Forms._sanitizeCompareValue(prevFormDoc[key])
-        if formValue != prevValue
-          # Ensure empty values are null.
-          changes[key] = formValue || null
-      changes
+      changes = Forms._getObjectChanges(prevFormDoc, formDoc)
+      # Ensure object values are flattened.
+      Objects.flattenProperties(changes)
 
     # Merges the latest document into the form, giving precedence to the changed values in the form.
     # @returns {Object} The flattened properties of the latest document which were merged into the

    else
      $input.prop('readonly', disabled)

  _sanitizeCompareValue: (value) -> value?.toString().trim() ? ''

  getInputId: ($input) -> $input.attr('data-schema-key')


      $input.val(value)
    return true

  getInputValue: ($input, schema) ->
    $input = $($input)
    element = $input[0]
    return unless element?
    
    # Attempt to obtain the value from AutoForm which will also parse it based on the schema and
    # support custom AutoForm fields.
    templateName = AutoForm.getInputTypeTemplateNameForElement(element)
    if templateName
      AutoForm.getInputValue(element, schema)
    # Otherwise try to parse it ourselves.
    else if @isSelectInput($input)
      @getSelectValue($input)
    else if @isDropdown($input)
      Template.dropdown.getValue($input)
