import operator


def get_field_set(items, getter=operator.attrgetter('id'), cast=int):
    """
    Get ids via getter and collect them in a set
    """
    return {cast(getter(item)) for item in items}