DeploymentCache deploymentCache = Context.getProcessEngineConfiguration().getDeploymentCache();
DbEntityManager dbEntityManager = commandContext.getDbEntityManager();
for (ProcessDefinitionEntity processDefinition : processDefinitions) {
if (deployment.isNew()) {
ProcessDefinitionEntity latestProcessDefinition = processDefinitionManager.findLatestProcessDefinitionByKey(processDefinition.getKey());
processDefinition.setDeploymentId(deployment.getId());
processDefinition.setVersion(getVersionForNewProcessDefinition(deployment, processDefinition, latestProcessDefinition));
processDefinition.setId(getProcessDefinitionId(deployment, processDefinition));