function add(elements, element, unique) {
  var canAdd = !unique || elements.indexOf(element) === -1;

  if (canAdd) {
    elements.push(element);
  }

  return canAdd;
}
Adds an element to a collection and returns true if the
element was added.

@param {Object[]} elements
@param {Object} element
@param {boolean} [unique]