code: protected Map<ProcessDefinitionEntity, ProcessDefinitionEntity> getPreviousVersionsOfProcessDefinitions(
              ParsedDeployment parsedDeployment) {
  
          Map<ProcessDefinitionEntity, ProcessDefinitionEntity> result = new LinkedHashMap<ProcessDefinitionEntity, ProcessDefinitionEntity>();
  
          for (ProcessDefinitionEntity newDefinition : parsedDeployment.getAllProcessDefinitions()) {
              ProcessDefinitionEntity existingDefinition = bpmnDeploymentHelper.getMostRecentVersionOfProcessDefinition(newDefinition);
  
              if (existingDefinition != null) {
                  result.put(newDefinition,
                             existingDefinition);
              }
          }
  
          return result;
      }
docs: Constructs a map from new ProcessDefinitionEntities to the previous version by key and tenant.
  If no previous version exists, no map entry is created.