Exception RecordInvalid shamelessly lifted from ActiveRecord.