 
         populateBinaryInformation = (newDoc) ->
             if newDoc.binary?
+                # Get the ID and the revision of the remote binary document
+                # (since binary documents are not synchronized with the local
+                # pouchDB)
                 binary.getRemoteDoc newDoc.binary.file.id, (err, binaryDoc) ->
                     uploadBinary newDoc, binaryDoc
             else
+                # If binary does not exist remotely yet, we have to
+                # create an empty binary document remotely to have
+                # an ID and a revision
                 binary.createEmptyRemoteDoc (err, binaryDoc) ->
                     uploadBinary newDoc, binaryDoc
 
         checkFileExistence = (newDoc) ->
+
+            # Get the existing file (if exists) to prefill
+            # document with its information
             pouch.allFiles false, (err, existingDocs) ->
                 if err and err.status isnt 404
                     callback err

        switch task.operation
            when 'put'
                if task.file?
                    @createFileDoc task.file, callback
            when 'get'
                if task.file?
                    binary.fetchOne deviceName, task.file, callback
                else
                    binary.fetchAll deviceName, callback
            else
                # rebuild
                if task.file?

                    saveBinaryDocument newDoc

        updateFileInformation = (existingDoc, newDoc) ->

            # Fullfill document information
            newDoc._id = existingDoc._id
            newDoc._rev = existingDoc._rev
            newDoc.creationDate = existingDoc.creationDate
