Remove trailing whitespace
Handle required ForeignKey DoesNotExist errors gracefully