public PlanetDetails createAndDumpBotPlanetDetails(
      final PersistenceManager pm, final long planetIndex) {
    PlanetDetails result = null;

    try {
      result =
          JDOUtils.runInTransaction(
              pm,
              new Callable<PlanetDetails>() {
                @Override
                public PlanetDetails call() throws Exception {
                  PlanetDetails result =
                      JDOUtils.getObjectById(pm, PlanetDetails.class, planetIndex, true);
                  if (result == null) {
                    result = GalaxyFactory.get().createBotPlanetDetails(planetIndex);
                    CacheUtils.put(PlanetDetails.class, planetIndex, result);
                    pm.makePersistent(result);
                  }
                  return result;
                }
              });
    } catch (Exception ex) {
      logger.severe(ex.getMessage());
    }

    return result;
  }
  public PlanetDetails createAndDumpHomePlanetDetails(
      final PersistenceManager pm,
      final long planetIndex,
      final String ownerId,
      final String ownerName)
      throws HomePlanetRegistrationException {
    PlanetDetails result = null;

    try {
      result =
          JDOUtils.runInTransaction(
              pm,
              new Callable<PlanetDetails>() {
                @Override
                public PlanetDetails call() throws Exception {
                  PlanetDetails cachedPlanetDetails =
                      CacheUtils.get(PlanetDetails.class, planetIndex);
                  PlanetDetails result =
                      JDOUtils.getObjectById(pm, PlanetDetails.class, planetIndex);
                  if (result == null) {
                    if (cachedPlanetDetails != null) {
                      result =
                          GalaxyFactory.get()
                              .convertBotPlanetDetailsToHomePlanetDetails(
                                  cachedPlanetDetails, ownerId, ownerName);
                    } else {
                      result =
                          GalaxyFactory.get()
                              .createHomePlanetDetails(planetIndex, ownerId, ownerName);
                    }
                    CacheUtils.put(PlanetDetails.class, planetIndex, result);
                    pm.makePersistent(result);
                  } else if (result.getOwnerId() == null) {
                    if (cachedPlanetDetails != null) {
                      result.merge(
                          GalaxyFactory.get()
                              .convertBotPlanetDetailsToHomePlanetDetails(
                                  cachedPlanetDetails, ownerId, ownerName));
                    } else {
                      result.merge(
                          GalaxyFactory.get()
                              .convertBotPlanetDetailsToHomePlanetDetails(
                                  result, ownerId, ownerName));
                    }
                    CacheUtils.put(PlanetDetails.class, planetIndex, result);
                  } else {
                    throw new HomePlanetRegistrationException();
                  }
                  return result;
                }
              });
    } catch (HomePlanetRegistrationException ex) {
      throw ex;
    } catch (Exception ex) {
      logger.severe(ex.getMessage());
    }

    return result;
  }