def METHOD_NAME(self, stepid, name, type):
    slug = identifiers.forceIdentifier(50, name)
    while True:
        try:
            logid = yield self.master.db.logs.METHOD_NAME(
                stepid=stepid, name=name, slug=slug, type=type)
        except KeyError:
            slug = identifiers.incrementIdentifier(50, slug)
            continue
        self.generateEvent(logid, "new")
        return logid