add duplicate constraints check and error popup
add bool value is_mandatory to create constraint function