private EntityData.Entity serializeEntityDelta(EntityRef entityRef, Prefab prefab) {
    EntityData.Entity.Builder entity = EntityData.Entity.newBuilder();
    entity.setId(entityRef.getId());
    entity.setParentPrefab(prefab.getName());
    for (Component component : entityRef.iterateComponents()) {
      if (component.getClass().equals(EntityInfoComponent.class)) continue;

      Component prefabComponent = prefab.getComponent(component.getClass());
      EntityData.Component componentData;
      if (prefabComponent == null) {
        componentData = serializeComponent(component);
      } else {
        componentData = serializeComponent(prefabComponent, component);
      }

      if (componentData != null) {
        entity.addComponent(componentData);
      }
    }
    for (Component prefabComponent : prefab.listComponents()) {
      if (!entityRef.hasComponent(prefabComponent.getClass())) {
        entity.addRemovedComponent(ComponentUtil.getComponentClassName(prefabComponent.getClass()));
      }
    }
    return entity.build();
  }
  @Override
  public EntityRef deserializeEntity(EntityData.Entity entityData) {
    EntityRef entity = entityManager.createEntityRefWithId(entityData.getId());
    if (entityData.hasParentPrefab()
        && !entityData.getParentPrefab().isEmpty()
        && prefabManager.exists(entityData.getParentPrefab())) {
      Prefab prefab = prefabManager.getPrefab(entityData.getParentPrefab());
      for (Component component : prefab.listComponents()) {
        String componentName = ComponentUtil.getComponentClassName(component.getClass());
        if (!containsIgnoreCase(componentName, entityData.getRemovedComponentList())) {
          entity.addComponent(componentLibrary.copy(component));
        }
      }
      entity.addComponent(new EntityInfoComponent(entityData.getParentPrefab()));
    }
    for (EntityData.Component componentData : entityData.getComponentList()) {
      Class<? extends Component> componentClass = getComponentClass(componentData);
      if (componentClass == null) continue;

      if (!entity.hasComponent(componentClass)) {
        entity.addComponent(deserializeComponent(componentData));
      } else {
        deserializeComponentOnto(entity.getComponent(componentClass), componentData);
      }
    }
    return entity;
  }