Abstracting IntegrityError