                 if error
                     server.logout -> server.emit "error", error
                 else
-                    console.log "#{mailToBe.remoteId} id saved successfully"
+                    #console.log "#{mailToBe.remoteId} id saved successfully"
                     mailsDone++
         
                     if mailsDone is mailsToGo

                                mailsDone++
                                job.progress mailsDone, results.length

                                if mailsToGo is mailsDone
                                    callback()
                                else
                                    fetchOne(server, i + 1, results, mailsDone)

        else
            server.logout ->
                if mailsToGo isnt mailsDone
                    msg = "Could not import all the mail. Retry"
                    server.emit "error", new Error(msg)


# Destroy helpers

Mailbox::destroyMails = (callback) ->
    Mail.requestDestroy "bymailbox", key: @id, callback

Mailbox::destroyMailsToBe = (callback) ->
    params =
        startkey: [@id]
        endkey: [@id + "0"]
    MailToBe.requestDestroy "bymailbox", params, callback

Mailbox::destroyAttachments = (callback) ->
    Attachment.requestDestroy "bymailbox", key: @id, callback

# Just to be able to recognise the mailbox in the console
Mailbox::toString = ->
    "[Mailbox #{@name} #{@id}]"

Mailbox::fetchFinished = (callback) ->
    @updateAttributes IMAP_last_fetched_date: new Date(), (error) =>
