class MailImpl implements Disposable, Mail {

    @Override
    public Serializable setAttribute(String key, Serializable object) {
        Preconditions.checkNotNull(key, "Key of an attribute should not be null");
        Attribute attribute = Attribute.convertToAttribute(key, object);
        Attribute previous = attributes.put(attribute.getName(), attribute);

        return toSerializable(previous);
    }

    private  MailImpl(String name,
                     String state,
                     Map<AttributeName, Attribute> attributes,
                     List<MailAddress> recipients,
                     PerRecipientHeaders perRecipientHeaders);

}