Modified class to have correct validations
Modified the way foreign keys are handled