function removeFromArray (array, element) {
  return array.filter(item => item.asKey() !== element.asKey())
}
Remove all occurrences of the element in the array.
@param {Array} array the array to filter.
@param {Object} element the element to remove.
@return {Array} new filtered array.