code: def __remove_category(self, id):
          
  
          affected_query = """
              SELECT id
                FROM facts
               WHERE activity_id in (SELECT id FROM activities where category_id=?)
          """
          affected_ids = [res[0] for res in self.fetchall(affected_query, (id,))]
  
          update = "update activities set category_id = -1 where category_id = ?"
          self.execute(update, (id, ))
  
          self.execute("delete from categories where id = ?", (id, ))
  
          self.__remove_index(affected_ids)
docs: move all activities to unsorted and remove category