     model = @store.modelFor(modelName)
     Ember.get(model, 'relationshipsByName')
 
+  getModelNames: ->
+    ['project', 'document', 'label', 'category', 'paragraph', 'selection']
+
 
 
 `export default ProjectUpload;`
ProjectUpload = Ember.Mixin.create

  uploadProject: (json) ->
    @prefixJson(json).then ->
      console.log(json)

  # Private
  prefixJson: (json) ->
    prefix = ''
    projectId = Object.keys(json.project.records)[0]
    modelNames = ['project', 'document', 'label', 'category', 'paragraph', 'selection']

    @availablePrefix(projectId, 0).then (prefix) =>
      console.log prefix

      modelNames.forEach (modelName) =>

        return unless json[modelName]
        records = json[modelName].records


  availablePrefix: (projectId, counter) ->
    deferred = Ember.RSVP.defer()
    prefix = projectId + counter
    console.log('prefix', prefix)
    @store.find('project', @addPrefix(prefix, projectId)).then (project) =>
      counter++
      @availablePrefix(projectId, counter).then (prefix) ->
        deferred.resolve(prefix)
    .catch ->
      deferred.resolve(prefix)

    deferred.promise

