Email Record: Preventing atomicity violations with contracts