async def remove(
        self,
        db: AsyncSession,
        *,
        id: UUID,
        current_user: User,
        uow: Optional[UnitOfWork] = None,
    ) -> Optional[ModelType]:
        """Delete an object.

        Args:
        ----
            db (AsyncSession): The database session.
            id (UUID): The UUID of the object to delete.
            current_user (User): The current user.
            uow (Optional[UnitOfWork]): The unit of work to use for the transaction.

        Returns:
        -------
            Optional[ModelType]: The deleted object.

        Raises:
        ------
            NotFoundException: If the object is not found.

        """
        query = select(self.model).where(self.model.id == id)
        result = await db.execute(query)
        db_obj = result.unique().scalar_one_or_none()

        if db_obj is None:
            raise NotFoundException(f"{self.model.__name__} not found")

        self._validate_if_user_has_permission(db_obj, current_user)

        await db.delete(db_obj)

        await db.flush()

        if not uow:
            await db.commit()

        return db_obj
Delete an object.

        Args:
        ----
            db (AsyncSession): The database session.
            id (UUID): The UUID of the object to delete.
            current_user (User): The current user.
            uow (Optional[UnitOfWork]): The unit of work to use for the transaction.

        Returns:
        -------
            Optional[ModelType]: The deleted object.

        Raises:
        ------
            NotFoundException: If the object is not found.

        
backend/airweave/crud/_base.py