title: Backbone: How to validate if a Model already exist in a Collection?
body: <p>Given this Backbone Collection</p>
  
  <pre><code>define  [
    'underscore',
    'backbone',
    'cs!models/floor'
  ], ( _, Backbone, Floor ) -&gt;
  return Backbone.Collection.extend
    model: Floor
    url: -&gt;
      return '/api/hotels/' + @hotelId + '/floors'
    initialize: (models, options) -&gt;
      if ( options.hotelId )
        @hotelId = options.hotelId
        @.fetch()
  
    parse: (response) -&gt;
      response.floors
  
    alreadyExist: -&gt;
      @.filter( (floor) -&gt;
        return floor.get('number') == @.attrs.get('number')
      )
  </code></pre>
  
  <p>and adding a new Model from a view the way below, how can I validate if the model already exist within the collection ?</p>
  
  <pre><code>add_floor: (e) -&gt;
    console.log ' Saving Floor '
    e.preventDefault()
    floorNumber =  $('input[name=floorNumber]').val()
    floorDescription = $('input[name=floorDescription]').val()
    return new NoticeView({ message: "Please enter a Floor Number.", displayLength: 10000 }) unless floorNumber
    if ! @collection.add({ number: floorNumber}).alreadyExist()
      @collection.create({ number: floorNumber, description: floorDescription }, {
        error: (model, response) -&gt;
          # $(e.target).removeClass('waiting');
          new ErrorView({ message: "Problem saving Floor " + response.responseText, displayLength: 10000 })
        success : (model, response) -&gt;
          console.log model
          console.log response
          new NoticeView({ message: "Floor successfully saved.", displayLength: 10000 })
      })
    else 
      new ErrorView({ message: "Floor already exist." + response.responseText,        displayLength: 10000 })
  </code></pre>