public void save() throws RegistryException{
EntityManager em = null;
try {
em = ResourceUtils.getEntityManager();
NodeInput existingInput = em.find(NodeInput.class, new NodeInput_PK(inputKey, nodeDetailResource.getNodeInstanceId()));
em.close();
em = ResourceUtils.getEntityManager();
em.getTransaction().begin();
NodeInput nodeInput = new NodeInput();
WorkflowNodeDetail nodeDetail = em.find(WorkflowNodeDetail.class, nodeDetailResource.getNodeInstanceId());
nodeInput.setNodeDetails(nodeDetail);
nodeInput.setNodeId(nodeDetail.getNodeId());
nodeInput.setInputKey(inputKey);
nodeInput.setInputKeyType(inputType);
nodeInput.setValue(value);
nodeInput.setMetadata(metadata);
if (existingInput != null){
existingInput.setNodeDetails(nodeDetail);
existingInput.setNodeId(nodeDetail.getNodeId());
existingInput.setInputKey(inputKey);