class ViewModel::References

def new_ref!(viewmodel)

to this serialization.
unpersisted viewmodels, use a counter to generate a reference key unique
Ensure stable reference keys for the same (persisted) viewmodels. For
def new_ref!(viewmodel)
  vm_ref = viewmodel.to_reference
  if vm_ref.model_id
    vm_ref.stable_reference
  else
    format('ref:i:%06<count>d', count: (@last_ref += 1))
  end
end