private void deserializeChildren(StubInputStream stream,
                                   Stub parent,
                                   @NotNull SerializationState state) throws IOException, SerializerNotFoundException {
    int childCount = DataInputOutputUtil.readINT(stream);
    for (int i = 0; i < childCount; i++) {
      boolean dangling = false;
      int id = DataInputOutputUtil.readINT(stream);
      if (id == 0) {
        dangling = true;
        id = DataInputOutputUtil.readINT(stream);
      }

      Stub child = getClassByIdLocal(id, parent, state).deserialize(stream, parent);
      if (dangling) {
        ((ObjectStubBase<?>) child).markDangling();
      }
      deserializeChildren(stream, child, state);
    }
  }
private void deserializeChildren(StubInputStream stream,
                                   Stub parent,
                                   @NotNull SerializationState state)