Moved Constraint code to the BaseController