@Override
 public void serialize(BserWriter writer) throws IOException {
   if (this.groupPeer == null) {
     throw new IOException();
   }
   writer.writeObject(1, this.groupPeer);
   writer.writeLong(4, this.rid);
   if (this.user == null) {
     throw new IOException();
   }
   writer.writeObject(3, this.user);
 }
  public byte[] buildContainer() throws IOException {
    DataOutput res = new DataOutput();
    BserWriter writer = new BserWriter(res);
    if (this instanceof ContentLocalContainer) {
      writer.writeInt(1, TYPE_LOCAL);
      writer.writeBytes(2, ((ContentLocalContainer) this).getContent().buildContainer());
    } else if (this instanceof ContentRemoteContainer) {
      writer.writeInt(1, TYPE_REMOTE);
      writer.writeBytes(2, ((ContentRemoteContainer) this).getMessage().buildContainer());
    } else {
      throw new IOException("Unknown type");
    }

    return res.toByteArray();
  }