function _renameItem(oldPath, newPath, newName, isFolder) {
        var result = new $.Deferred();

        if (oldPath === newPath) {
            result.resolve();
        } else if (!isValidFilename(newName)) {
            result.reject(ERROR_INVALID_FILENAME);
        } else {
            var entry = isFolder ? FileSystem.getDirectoryForPath(oldPath) : FileSystem.getFileForPath(oldPath);
            entry.rename(newPath, function (err) {
                if (err) {
                    result.reject(err);
                } else {
                    result.resolve();
                }
            });
        }

        return result.promise();
    }
Rename a file/folder. This will update the project tree data structures
and send notifications about the rename.

@param {string} oldPath Old name of the item with the path
@param {string} newPath New name of the item with the path
@param {string} newName New name of the item
@param {boolean} isFolder True if item is a folder; False if it is a file.
@return {$.Promise} A promise object that will be resolved or rejected when
  the rename is finished.