@Transactional public void save(final List<WorkFlowMatrix> actualWorkFlowMatrixDetails,final String[] departments){
  for (  final String dept : departments) {
    for (    final WorkFlowMatrix workFlowMatrix : actualWorkFlowMatrixDetails) {
      final WorkFlowMatrix wfObj=workFlowMatrix.clone();
      if (dept.equals(DEFAULT)) {
        wfObj.setDepartment("ANY");
      }
 else {
        wfObj.setDepartment(dept);
      }
      workflowMatrixRepository.save(wfObj);
    }
  }
}

@ Transactional public void save ( final List < WorkFlowMatrix > actualWorkFlowMatrixDetails , final String [ ] departments ) { for ( final String dept : departments ) { for ( final WorkFlowMatrix workFlowMatrix : actualWorkFlowMatrixDetails ) { final WorkFlowMatrix wfObj = workFlowMatrix . clone ( ) ; if ( dept . equals ( DEFAULT ) ) { wfObj . setDepartment ( "ANY" ) ; } else { wfObj . setDepartment ( dept ) ; } workflowMatrixRepository . save ( wfObj ) ; } } }
this method saves the workflow matrix details for every department selected
