'API call to update toolbox filters data.'

@expose_api
def set_toolbox_filters(self, trans, id, payload={}, **kwd):

    user = self._get_user(trans, id)
    filter_types = self._get_filter_types(trans)
    for filter_type in filter_types:
        new_filters = []
        for prefixed_name in payload:
            prefix = (filter_type + '|')
            if prefixed_name.startswith(filter_type):
                new_filters.append(prefixed_name[len(prefix):])
        user.preferences[filter_type] = ','.join(new_filters)
    trans.sa_session.add(user)
    trans.sa_session.flush()
    return {'message': 'Toolbox    filters    have    been    saved.'}
