 
   ###*
     @param {app.songs.Song} song
+    @return {goog.Promise}
   ###
   publish: (song) ->
     publishedSong = @createPublishedSong_ song

  constructor: (@dispatcher, @routes, @xhr, @userStore) ->
    super 'songs'

    ###* @type {Array.<app.songs.Song>} ###
    @recentlyUpdatedSongs = []

    ###* @type {Array.<app.songs.Song>} ###
    @songsByUrl = []

    @dispatcherIndex = @dispatcher.register @handleAction_.bind @

  @Actions:
    PUBLISH_SONG: 'publish-song'
    UNPUBLISH_SONG: 'unpublish-song'

  handleAction_: (action, payload) ->
    switch action

        @xhr
          .put @routes.api.songs.id.url(id: payload.song.id), payload.json
          .then => @userStore.setSongPublisher payload.song
      when Store.Actions.SEARCH
        @xhr
          .get @routes.api.songs.search.url null, query: payload.query
          .then (songs) =>
            @fromJson foundSongs: songs
            @notify()
      when Store.Actions.UNPUBLISH_SONG
        @xhr
          .delete @routes.api.songs.id.url(id: payload.song.id)
