publishedWorkflow.setPublish_workflow_name(getName());
publishedWorkflow.setPublished_date(publishedDate);
publishedWorkflow.setVersion(version);
byte[] bytes = content.getBytes();
publishedWorkflow.setWorkflow_content(bytes);
Gateway existingGateway = em.find(Gateway.class, gateway.getGatewayName());
publishedWorkflow.setGateway(existingGateway);
publishedWorkflow.setGateway_name(existingGateway.getGateway_name());
Users user = em.find(Users.class, createdUser);
publishedWorkflow.setUser(user);
if (existingWF != null) {
existingWF.setUser(user);
existingWF.setGateway(existingGateway);
existingWF.setGateway_name(existingGateway.getGateway_name());
existingWF.setPublished_date(publishedDate);
existingWF.setWorkflow_content(bytes);
existingWF.setVersion(version);
existingWF.setPath(path);
publishedWorkflow = em.merge(existingWF);