def serialize(value)
      return if value.nil?
      undashed_uuid = strip_dashes(value)

      # To avoid SQL injection, verify that it looks like a UUID. ActiveRecord
      # does not explicity escape the Binary data type. escaping is implicit as
      # the Binary data type always converts its value to a hex string.
      unless valid_undashed_uuid?(undashed_uuid)
        raise MySQLBinUUID::InvalidUUID, "#{value} is not a valid UUID"
      end

      Data.new(undashed_uuid)
    end
def serialize(value)
      return if value.nil?
      undashed_uuid = strip_dashes(value)

      # To avoid SQL injection, verify that it looks like a UUID. ActiveRecord
      # does not explicity escape the Binary data type. escaping is implicit as
      # the Binary data type always converts its value to a hex string.
      unless valid_undashed_uuid?(undashed_uuid)
        raise MySQLBinUUID::InvalidUUID, "#{value} is not a valid UUID"
      end

      Data.new(undashed_uuid)
    end
Invoked when the provided value needs to be serialized before storing
 it to the database.