def METHOD_NAME(self):
    # Validate maximal nesting depth
    depth = self._get_childs_depth() if self.pk else 1
    current = self
    while current.category:
        depth += 1
        current = current.category
    if depth > CATEGORY_DEPTH:
        raise ValidationError(
            {"category": gettext("Too deep nesting of categories!")}
        )
    if self.category and self.category.project != self.project:
        raise ValidationError(
            {"category": gettext("Parent category has to be in the same project!")}
        )
    if self.category and self == self.category:
        raise ValidationError(
            {"category": gettext("Parent category has to be different!")}
        )
    # Validate category/component name uniqueness at given level
    self.clean_unique_together()
    if self.id:
        old = Category.objects.get(pk=self.id)
        self.check_rename(old, validate=True)