def METHOD_NAME(self, domain_id, update_domain=True):
    with app.app_context():
        card = (
            r.table("domains").get(domain_id).pluck("image").run(db.conn)["image"]
        )
    if card["image"]["type"] == "user":
        if update_domain:
            with app.app_context():
                r.table("domains").get(domain_id).update(
                    {"image": self.get_domain_stock_card(domain_id)}
                ).run(db.conn)
        self.delete_card(card["id"])