Handles `remove` action from CategoryList editor.

        Removes an actual category if a target object is not set for the list.
        Removes a tie-to-category object if a target object is set for the list.

        :param Request request: Django request object
        :param CategoryList category_list: CategoryList object to operate upon.
        :return: True on success otherwise and exception from SitecatsException family is raised.

def action_remove(cls, request, category_list):
        """Handles `remove` action from CategoryList editor.

        Removes an actual category if a target object is not set for the list.
        Removes a tie-to-category object if a target object is set for the list.

        :param Request request: Django request object
        :param CategoryList category_list: CategoryList object to operate upon.
        :return: True on success otherwise and exception from SitecatsException family is raised.
        """
        if not category_list.editor.allow_remove:
            raise SitecatsSecurityException(
                '`action_remove()` is not supported by parent `%s`category.' % category_list.alias)

        category_id = int(request.POST.get('category_id', 0))
        if not category_id:
            raise SitecatsSecurityException(
                'Unsupported `category_id` value - `%s` - is passed to `action_remove()`.' % category_id)

        category = get_cache().get_category_by_id(category_id)
        if not category:
            raise SitecatsSecurityException('Unable to get `%s` category in `action_remove()`.' % category_id)

        cat_ident = category.alias or category.id

        if category.is_locked:
            raise SitecatsSecurityException('`action_remove()` is not supported by `%s` category.' % cat_ident)

        if category.parent_id != category_list.get_id():
            raise SitecatsSecurityException(
                '`action_remove()` is unable to remove `%s`: '
                'not a child of parent `%s` category.' % (cat_ident, category_list.alias)
            )

        min_num = category_list.editor.min_num

        def check_min_num(num):
            if min_num is not None and num-1 < min_num:
                subcats_str = ungettext_lazy('subcategory', 'subcategories', min_num)
                error_msg = _(
                    'Unable to remove "%(target_category)s" category from "%(parent_category)s": '
                    'parent category requires at least %(num)s %(subcats_str)s.'
                ) % {
                    'target_category': category.title,
                    'parent_category': category_list.get_title(),
                    'num': min_num,
                    'subcats_str': subcats_str
                }
                raise SitecatsValidationError(error_msg)

        child_ids = get_cache().get_child_ids(category_list.alias)
        check_min_num(len(child_ids))
        if category_list.obj is None:  # Remove category itself and children.
            category.delete()
        else:  # Remove just a category-to-object tie.
            # TODO filter user/status
            check_min_num(category_list.obj.get_ties_for_categories_qs(child_ids).count())
            category_list.obj.remove_from_category(category)

        return True