def generate_filter_dict(model, filterset=None):
    """
    Used the generate the filter for the query based of the parameters sent from the request.
    :param filterset: A dict of query parameters i.e. key/value
    :return appfilter: A cleaned up (is valid property on model) dict of query parameters
    """
    appfilter = {'active': True, 'featured': True}
    if filterset:
        for key, value in filterset.items():
            field = getattr(model, key, None)
            if field:
                appfilter[key] = value
    return appfilter