public void applyRemotePlayerData(NetworkPlayer networkPlayer) {
    synchronized (buildings) {
      Iterator<Entry<Long, NetworkBuilding>> previouslyKnownBuildings =
          buildings.entrySet().iterator();
      while (previouslyKnownBuildings.hasNext()) {
        Entry<Long, NetworkBuilding> building = previouslyKnownBuildings.next();
        if (!networkPlayer.buildings.containsKey(building.getKey())) {
          previouslyKnownBuildings.remove();
        }
      }
      for (NetworkBuilding building : networkPlayer.getBuildings().values()) {
        building.mirror();
        if (buildings.containsKey(building.getAssetId())) {
          buildings.get(building.getAssetId()).applyRemoteAssetData(building);
        } else {
          buildings.put(building.getAssetId(), building);
        }
      }
    }

    synchronized (units) {
      Iterator<Entry<Long, NetworkUnit>> previouslyKnownUnits = units.entrySet().iterator();
      while (previouslyKnownUnits.hasNext()) {
        Entry<Long, NetworkUnit> unit = previouslyKnownUnits.next();
        if (!networkPlayer.units.containsKey(unit.getKey())) {
          previouslyKnownUnits.remove();
        }
      }
      for (NetworkUnit unit : networkPlayer.getUnits().values()) {
        unit.mirror();
        if (units.containsKey(unit.getAssetId())) {
          units.get(unit.getAssetId()).applyRemoteAssetData(unit);
        } else {
          units.put(unit.getAssetId(), unit);
        }
      }
    }
  }