code: function removeFieldsFromObj(data, fieldsToRemove) {
      _.each(fieldsToRemove, function (fieldToRemove) {
  
          // if field to remove is in the data, just remove it and go to the next one
          if (data[fieldToRemove]) {
              delete data[fieldToRemove];
              return true;
          }
  
          var fieldParts = fieldToRemove.split('.');
          var fieldPart;
          var dataPointer = data;
          var len = fieldParts.length;
          for (var i = 0; i < len; i++) {
              fieldPart = fieldParts[i];
  
              // if the field doesn't exist, break out of the loop
              if (!dataPointer[fieldPart]) {
                  break;
              }
              // if we are at the end then delete the item from the updatedData
              else if (i === (len - 1)) {
                  delete dataPointer[fieldPart];
              }
              // else move the pointer down the object tree and go to the next iteration
              else {
                  dataPointer = dataPointer[fieldPart];
              }
          }
  
          return true;
      });
  
      return data;
  }
docs: Remove all specified fields from a given object based on input
  of field paths. The field path must match a object field to
  be removed.
  @param data Data to be changed
  @param fieldsToRemove An array of field paths
  @returns {{}}