-                // create new OCFile instance for the renamed file
-                /*OCFile newFile = new OCFile(mStorageManager.getFileById(mFile.getParentId()).getRemotePath() + mNewName;   // TODO - NOT CREATE NEW OCFILE; ADD setFileName METHOD 
-                OCFile oldFile = mFile;
-                mFile = newFile; */
-                mFile.setFileName(mNewName);
-                
-                // try to rename the local copy of the file
-                if (mFile.isDown()) {
-                    File f = new File(mFile.getStoragePath());
-                    String newStoragePath = f.getParent() + mNewName;
-                    if (f.renameTo(new File(newStoragePath))) {
-                        mFile.setStoragePath(newStoragePath);
-                    }
-                    // else - NOTHING: the link to the local file is kept although the local name can't be updated
-                    // TODO - study conditions when this could be a problem
-                }
-                
-                //mStorageManager.removeFile(oldFile, false);
-                mStorageManager.saveFile(mFile);
-             
-            /* 
-             *} else if (mFile.isDirectory() && (status == 207 || status >= 500)) {
-             *   // TODO 
-             *   // if server fails in the rename of a folder, some children files could have been moved to a folder with the new name while some others
-             *   // stayed in the old folder;
-             *   //
-             *   // easiest and heaviest solution is synchronizing the parent folder (or the full account);
-             *   //
-             *   // a better solution is synchronizing the folders with the old and new names;
-             *}
-             */
-                
+            // check local overwrite
+            if (getStorageManager().getFileByPath(mNewRemotePath) != null) {
+                return new RemoteOperationResult(ResultCode.INVALID_OVERWRITE);