def METHOD_NAME(
    model, column_name, value, parameter_name, filter_deleted=True
):
    """
    Wrapper query to properly raise exception after filtering the soft deleted entries
    :param model: db Model to be queried
    :param column_name: name of the column to be queried for the given value
    :param value: value to be queried against the given column name, e.g view_kwargs['event_id']
    :param parameter_name: Name of parameter to be printed in json-api error message eg 'event_id'
    :param filter_deleted: Deleted records are filtered if set to true
    :return:
    """
    try:
        record = model.query.filter(getattr(model, column_name) == value)
        if filter_deleted and hasattr(model, 'deleted_at'):
            record = record.filter_by(deleted_at=None)
        record = record.one()
    except NoResultFound:
        raise ObjectNotFound(
            {'parameter': f'{parameter_name}'},
            f"{model.__name__}: {value} not found",
        )
    else:
        return record