def addFile(self, troveInfo, pathId, path, fileId, fileVersion,
                fileStream = None, isPresent = True):
        (cu, troveInstanceId, addFileStmt, oldInstanceId) = troveInfo
        versionId = self.getVersionId(fileVersion, self.addVersionCache)

        if fileStream:
            cu.execstmt(addFileStmt, pathId, versionId, path, fileId,
                        fileStream, isPresent)

            tags = files.frozenFileTags(fileStream)

            if tags:
                cu.executemany("INSERT INTO NewFileTags VALUES (?, ?)",
                               itertools.izip(itertools.repeat(pathId), tags))
        else:
            cu.execute("""
              UPDATE DBTroveFiles
                  SET instanceId=?, isPresent=?, path=?, versionId=?
                  WHERE pathId=? AND instanceId=?""",
                    troveInstanceId, isPresent, path, versionId,
                    pathId, oldInstanceId)