anchor.diff:    {
       _messageGenerator = messageGenerator;
     }
  -
   <% repository.data_modules.select { |data_module| data_module.imit?  }.each do |data_module| -%>
  -<% data_module.entities.select { |entity| entity.imit? && !entity.abstract? }.each do |entity| %>
  +<%
  +  data_module.entities.select { |entity| entity.imit? && !entity.abstract? }.each do |entity|
  +    outgoing_links = entity.referencing_attributes.select{|a| a.imit? && a.imit.client_side? && a.inverse.imit.traversable?}
  +    replication_modes = outgoing_links.select{|a| a.inverse.imit?}.collect{|a| a.inverse.imit.replication_modes }
  +    replication_modes = replication_modes.flatten.sort.uniq
  +-%>
   <% if entity.imit.replication_root? -%>
     public void encode<%= entity.name %>( @javax.annotation.Nonnull final java.util.LinkedList<org.realityforge.replicant.server.EntityMessage> messages, @javax.annotation.Nonnull final <%= entity.jpa.qualified_name %> object )
     {
  
positive.code:   <%= entity.imit.replication_root? ? "public" : "private" %> void encode<%= entity.name %>( @javax.annotation.Nonnull final java.util.LinkedList<org.realityforge.replicant.server.EntityMessage> messages, @javax.annotation.Nonnull final <%= entity.jpa.qualified_name %> object, @javax.annotation.Nonnull final Mode mode )
    {
      encodeObject( messages, object );
  
      <%
    outgoing_links = entity.referencing_attributes.select{|a| a.imit? && a.imit.client_side? && a.inverse.imit.traversable?}
    replication_modes = outgoing_links.select{|a| a.inverse.imit?}.collect{|a| a.inverse.imit.replication_modes } + [:default]
    replication_modes = replication_modes.flatten.sort.uniq
    replication_modes.each do |replication_mode|
  %>if( Mode.<%= Domgen::Naming.uppercase_constantize(replication_mode) %> == mode )
      {
  <%
      outgoing_links.each do |a|
        if a.inverse.multiplicity == :many
  %>
        encodeObjects( messages, object.get<%= Domgen::Naming.pluralize(a.inverse.name) %>() );
  <%
        elsif a.inverse.multiplicity == :one || a.inverse.multiplicity == :zero_or_one
  -%>
        encodeObject( messages, object.get<%= a.inverse.name %>() );
  <%
        end
      end
  
negative.code:     }
      else <%
    end
    if 0 != replication_modes.size
  %>
      {
        throw new IllegalArgumentException("Unknown mode " + mode);
      }
  <% end -%>
    }
  <%
    end
  end -%>
  
    public void encodeObjects( @javax.annotation.Nonnull final java.util.LinkedList<org.realityforge.replicant.server.EntityMessage> messages, @javax.annotation.Nonnull final java.util.List objects )
    {
  