private void populateDependencies(Vertex vertex, ModuleDefinition moduleDefinition, boolean optional) {
final List<String> dependentModuleNames = moduleDefinition.getDependentModuleNames(optional);
for (String dependent : dependentModuleNames) {
final Vertex dependentVertex = vertexMap.get(dependent);
if (dependentVertex == null) {
if (!optional) {
throw new InvalidStateException("Unable to dependency named named '" + dependent
+ "' for module definition '" + moduleDefinition.getName() + "'");