It was causing 500 internal server errors because after sanitization it would be set to null but a valid value would be needed for a couple of actions on the website, like assigning students to programs and assigning students to courses.