boost::optional<IdfObject> ForwardTranslator::translateSpaceType( SpaceType & modelObject )
{
  std::vector<Space> spaces = modelObject.spaces();

  // check if this is a dummy space type meant to prevent inheriting building space type
  std::vector<ModelObject> children = modelObject.children();
  if (children.empty()){
    LOG(Info, "SpaceType " << modelObject.name().get() << " has no children, it will not be translated");
    return boost::none;
  }

  IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::ZoneList, 
                                                       modelObject);

  std::set<std::string> zoneNames;
  for (const Space& space : spaces){
    boost::optional<ThermalZone> thermalZone = space.thermalZone();
    if (thermalZone){
      zoneNames.insert(thermalZone->name().get());
    }
  }

  idfObject.clearExtensibleGroups();
  for (const std::string& zoneName : zoneNames){
    idfObject.pushExtensibleGroup(std::vector<std::string>(1, zoneName));
  }

  // translate internal mass
  InternalMassVector internalMasses = modelObject.internalMass();
  std::sort(internalMasses.begin(), internalMasses.end(), WorkspaceObjectNameLess());
  for (InternalMass& internalMass : internalMasses){
    translateAndMapModelObject(internalMass);
  }

  // translate lights
  LightsVector lights = modelObject.lights();
  std::sort(lights.begin(), lights.end(), WorkspaceObjectNameLess());
  for (Lights& light : lights){
    translateAndMapModelObject(light);
  }

  // translate luminaires
  LuminaireVector luminaires = modelObject.luminaires();
  std::sort(luminaires.begin(), luminaires.end(), WorkspaceObjectNameLess());
  for (Luminaire& luminaire : luminaires){
    translateAndMapModelObject(luminaire);
  }

  // translate people
  PeopleVector people = modelObject.people();
  std::sort(people.begin(), people.end(), WorkspaceObjectNameLess());
  for (People& person : people){
    translateAndMapModelObject(person);
  }

  // translate electric equipment
  ElectricEquipmentVector electricEquipment = modelObject.electricEquipment();
  std::sort(electricEquipment.begin(), electricEquipment.end(), WorkspaceObjectNameLess());
  for (ElectricEquipment& equipment : electricEquipment){
    translateAndMapModelObject(equipment);
  }

  // translate gas equipment
  GasEquipmentVector gasEquipment = modelObject.gasEquipment();
  std::sort(gasEquipment.begin(), gasEquipment.end(), WorkspaceObjectNameLess());
  for (GasEquipment& equipment : gasEquipment){
    translateAndMapModelObject(equipment);
  }

  // translate hot water equipment
  HotWaterEquipmentVector hotWaterEquipment = modelObject.hotWaterEquipment();
  std::sort(hotWaterEquipment.begin(), hotWaterEquipment.end(), WorkspaceObjectNameLess());
  for (HotWaterEquipment& equipment : hotWaterEquipment){
    translateAndMapModelObject(equipment);
  }

  // translate steam equipment
  SteamEquipmentVector steamEquipment = modelObject.steamEquipment();
  std::sort(steamEquipment.begin(), steamEquipment.end(), WorkspaceObjectNameLess());
  for (SteamEquipment& equipment : steamEquipment){
    translateAndMapModelObject(equipment);
  }

  // translate other equipment
  OtherEquipmentVector otherEquipment = modelObject.otherEquipment();
  std::sort(otherEquipment.begin(), otherEquipment.end(), WorkspaceObjectNameLess());
  for (OtherEquipment& equipment : otherEquipment){
    translateAndMapModelObject(equipment);
  }

  // translate SpaceInfiltration_DesignFlowRate
  SpaceInfiltrationDesignFlowRateVector spaceInfiltrationDesignFlowRates = modelObject.spaceInfiltrationDesignFlowRates();
  std::sort(spaceInfiltrationDesignFlowRates.begin(), spaceInfiltrationDesignFlowRates.end(), WorkspaceObjectNameLess());
  for (SpaceInfiltrationDesignFlowRate& spaceInfiltrationDesignFlowRate : spaceInfiltrationDesignFlowRates){
    translateAndMapModelObject(spaceInfiltrationDesignFlowRate);
  }

  // translate SpaceInfiltration_EffectiveLeakageArea
  SpaceInfiltrationEffectiveLeakageAreaVector spaceInfiltrationEffectiveLeakageAreas = modelObject.spaceInfiltrationEffectiveLeakageAreas();
  std::sort(spaceInfiltrationEffectiveLeakageAreas.begin(), spaceInfiltrationEffectiveLeakageAreas.end(), WorkspaceObjectNameLess());
  for (SpaceInfiltrationEffectiveLeakageArea& spaceInfiltrationEffectiveLeakageArea : spaceInfiltrationEffectiveLeakageAreas){
    translateAndMapModelObject(spaceInfiltrationEffectiveLeakageArea);
  }

  return idfObject;
}
    PeopleVector people = spaces[0].people();
    std::sort(people.begin(), people.end(), WorkspaceObjectNameLess());
    BOOST_FOREACH(People& person, people){
      translateAndMapModelObject(person);
    }

    // translate electric equipment
    ElectricEquipmentVector electricEquipment = spaces[0].electricEquipment();
    std::sort(electricEquipment.begin(), electricEquipment.end(), WorkspaceObjectNameLess());
    BOOST_FOREACH(ElectricEquipment& equipment, electricEquipment){
      translateAndMapModelObject(equipment);
    }

    // translate gas equipment
    GasEquipmentVector gasEquipment = spaces[0].gasEquipment();
    std::sort(gasEquipment.begin(), gasEquipment.end(), WorkspaceObjectNameLess());
    BOOST_FOREACH(GasEquipment& equipment, gasEquipment){
      translateAndMapModelObject(equipment);
    }

    // translate hot water equipment
    HotWaterEquipmentVector hotWaterEquipment = spaces[0].hotWaterEquipment();
    std::sort(hotWaterEquipment.begin(), hotWaterEquipment.end(), WorkspaceObjectNameLess());
    BOOST_FOREACH(HotWaterEquipment& equipment, hotWaterEquipment){
      translateAndMapModelObject(equipment);
    }

    // translate steam equipment
    SteamEquipmentVector steamEquipment = spaces[0].steamEquipment();
    std::sort(steamEquipment.begin(), steamEquipment.end(), WorkspaceObjectNameLess());
    BOOST_FOREACH(SteamEquipment& equipment, steamEquipment){