   removeFromSaveArray: (file) ->
     fileName = @getFileFullPath file
     index = @filesToSave.indexOf fileName
-    if index > -1
-      @filesToSave.splice index, 1
-      @storage.setValue "saveRequestedFiles", @filesToSave
+    return  unless index > -1
+    @filesToSave.splice index, 1
+    @storage.setValue "saveRequestedFiles", @filesToSave
 
-  patchFileIfDiffExist: (file, localContent, cb)->
-    KD.singletons.vmController.info file.vmName, (err, vm, info)=>
-      # TODO : we may need to listen vmController when state is not RUNNING
+  patchFileIfDiffExist: (file, localContent, cb, callCounter = 0)->
+    KD.singletons.vmController.info file.vmName, @utils.getTimedOutCallback (err, vm, info)=>
       return cb err unless info.state is "RUNNING"
       file.fetchContents (err, content)=>
         if content and not err
           newContent = @getPatchedContent content, localContent
-          if newContent
-            file.save newContent[0],
-            @utils.getTimedOutCallback (err, res)=>
+          unless content is localContent
+            file.save localContent, (err, res)=>
               return cb err if err
               @removeFromSaveArray file
               @removeFileContentFromLocalStorage file
+              @updateEditorStatus file, localContent
               @emit "LocalContentSynced", file
               cb null, file
-            ->
-              @emit "LocalContentCouldntSynced", file
           else
             @removeFromSaveArray file
             cb null, file
+    ,=>
+      ++callCounter
+      if callCounter > 5
+        @emit "VMNotResponding", file
+      else
+        @patchFileIfDiffExist file, localContent, cb, callCounter
 
   getPatchedContent: (originalContent, localContent)->
     dmp = new diff_match_patch

    fileName = "[#{file.vmName}]#{plainPath}"
    return fileName

  saveEditorHistory: ->
    log "NOT IMPLEMENTED YET"

    @initializeListeners()

  initializeListeners: ->
    KD.remote.on "reconnected", =>
      return  if @synStarted
      @synStarted = yes
      @syncLocalContentIfDiffExists (err)=>
