def to_dict_with_custom_fields(instance, custom_fields):
    """ Convert an object to a dictionary with only some of the fields that
    exist on the object. Some fields also require some manual handling.
    :param instance: Object to be converted.
    :param custom_fields: List of fields to include in dict.
    :return: Dictionary with custom fields.
    """
    result = {}
    for field in instance._meta.fields:
        if field.name in custom_fields:
            if field.name == "avatar":  # CoreUser field
                result[field.name] = instance.avatar.path if instance.avatar else None
            elif field.name == "logo":  # Client field
                result[field.name] = instance.logo.path if instance.logo else None
            elif field.name == "country":  # User field
                result[field.name] = instance.country.code if instance.country else None
            elif field.name == "organisation":  # User field
                result["organisation_id"] = \
                    instance.organisation.id if instance.organisation else None
            else:
                result[field.name] = getattr(instance, field.name)
    return result