       throw new Error "SharedCollection needs a collectionId in options!"
 
     super
+
+  mapTypes: (modelClasses) ->
+    for Model in modelClasses
+      if not Model::type
+        throw new Error "Model class #{ Model::constructor.name } is missing `type` attribute."
+      @classMap[Model::type] = Model
 
   handleError: (model) => (err) =>
     if err

    S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4()

  constructor: (models, opts={}) ->
    @modelTypes = opts.modelTypes or {}
    if opts.sharejsDoc
      @_syncDoc = opts.sharejsDoc



    if not (model instanceof Backbone.Model)
      attrs = model
      Model = @classMap[attrs.type] or @model
      model = new Model attrs,
        collection: this
      if model.validate and not model._performValidation(attrs, options)
