           , callback
           disownItem item for own id, item of items
         (pubInst, modal) =>
-          log modal
+          # log modal
           disownAll @selection, =>
-            log "2", modal
+            # log "2", modal
             for own id, {item, paneView} of @selection
               item.destroy()
               paneView.destroy()
               @deselectMessages()
             modal.destroy()
-  
+            newMessageBar.disableMessageActionButtons()
+
     newMessageBar.registerListener
       KDEventTypes: 'MessageShouldBeMarkedAsUnread'
       listener    : @
       callback    : =>
         for own id, {item, data} of @selection
-          log 'marking unread'
-          data.unmark 'read', (err)->
+          # log 'marking unread'
+          data.unmark 'read', (err)=>
             log err if err
             item.setClass 'unread' unless err
-  
+            newMessageBar.disableMessageActionButtons()
+
   goToNotifications:(notification)->
     @getView().showTab "notifications"
     @mainView.propagateEvent KDEventType : 'NotificationIsSelected', {item: notification, event} if notification?
-    
+
   goToMessages:(message)->
     @getView().showTab "messages"
     @mainView.propagateEvent KDEventType : "MessageIsSelected", {item: message, event} if message?

  {race} = bongo

  constructor:(options, data)->
    view = new (KD.getPageClass 'Inbox') cssClass : "inbox-application" 
    options = $.extend {view},options
    super options,data
    @selection = {}


  deselectMessages:->
    @selection = {}

  sendMessage:(messageDetails, callback)->
    # log "I just send a new message: ", messageDetails
    bongo.api.JPrivateMessage.create messageDetails, callback

  prepareMessage:(formOutput, callback)=>
    {body, subject, recipients} = formOutput

    to = recipients.join ' '

    @sendMessage {to, body, subject}, (err, message)->
      new KDNotificationView
        title     : if err then "There was an error sending your message - try again" else "Message Sent!"
