def _serialize(self, value, attr, obj):
        """Grab the ID value off the Peewee model so we serialize an ID back.
        """
        # this might be an optional field
        if value:
            value = value.id

        return super(ForeignKeyField, self)._serialize(value, attr, obj)