def __updateDataRefAndFilesystem(self, item, persistentItem, newSrcAbsPath, newDstRelPath, userLogin):
        origSrcAbsPath = None if persistentItem.data_ref is None \
                              else os.path.join(self._repoBasePath, persistentItem.data_ref.url)
        assert origSrcAbsPath is None or len(origSrcAbsPath) > 0
        assert origSrcAbsPath is None or os.path.isabs(origSrcAbsPath)

        if origSrcAbsPath is None and newSrcAbsPath is None:
            # Item is not linked with a file neither before nor after update. Do nothing.
            assert newDstRelPath is None
            return

        if origSrcAbsPath is None and newSrcAbsPath is not None:
            # Item was without a file, and now it is linked with a file
            self.__addStoredOrUntrackedFile(persistentItem, newSrcAbsPath, newDstRelPath, userLogin)
            return

        if origSrcAbsPath is not None and newSrcAbsPath is None:
            # Item was linked with a file, now it is leaved without a file
            assert newDstRelPath is None
            operations.ItemOperations.removeFile(self._session, persistentItem)
            return

        if origSrcAbsPath is not None and origSrcAbsPath != newSrcAbsPath:
            # Item was with file1, now it is linked with a file2
            operations.ItemOperations.removeFile(self._session, persistentItem)
            self.__addStoredOrUntrackedFile(persistentItem, newSrcAbsPath, newDstRelPath, userLogin)
            return

        if origSrcAbsPath is not None and origSrcAbsPath == newSrcAbsPath:
            # Item was with a file, and after update it should be with the same file, but
            # it could be renamed or moved somewhere else within repository.
            origFileRelPath = os.path.relpath(origSrcAbsPath, self._repoBasePath)
            if newDstRelPath != origFileRelPath:
                # Item was with a file, but this file is going to be renamed or moved
                operations.ItemOperations.moveFile(self._session, persistentItem,
                                                   self._repoBasePath, newDstRelPath)
            else:
                # Nothing has changed, do nothing
                pass
            return