export default function dataFromControls (controls) {

  var data = {};

  // gather and clean data for storage
  controls.filterBy('value').forEach(function (control) {
    var value = control.get('value');

    // hax
    // firebase doesn't like undefined values and for some reason `_super` is
    // being added to arrays in ember with undefined value
    if (Ember.isArray(value)) {
      delete value._super;
    }

    if (control.get('controlType.valueType') === 'object') {

      switch (control.get('controlType.widget')) {
      case 'tabular':
        var convertedValue = Ember.A([]);
        value.forEach(function (row) {
          convertedValue.push(row.mapBy('value'));
        });
        value = convertedValue;
        break;
      default:
        Ember.$.each(value, function (key, childValue) {
          if (!childValue) {
            delete value[key];
          }
        });
        break;
      }

    }

    // add timezone to datetime values
    if (control.get('controlType.widget') === 'datetime') {
      value = moment(value).format();
    }

    data[control.get('name')] = value;
  });

  // checkboxes are special
  controls.filterBy('controlType.widget', 'checkbox').forEach(function (control) {
    data[control.get('name')] = [];
    control.get('meta.data.options').forEach(function (option) {
      data[control.get('name')].push(option);
    });
  });

  return data;
}

@@ -669,26 +669,77 @@
 (row.map
-By('value'
+(function (cell) %7B%0A            return cell %7C%7C %22%22;%0A          %7D
 ));%0A    

handle saving empty tabular rows