public static StationElementProxy convertToProxy( CategoryElementsListAdapter.ViewModel viewModel) { StationElementProxy proxy = new StationElementProxy(); StationElement se = new StationElement(); Element element = new Element(); DescriptorServices.setByFieldDescriptor(viewModel, element); DescriptorServices.setByFieldDescriptor(viewModel, se); List<StationElementMeta> metaElements = MetaDataService.fromAnnotations(viewModel, true); if (metaElements != null && metaElements.size() > 0) se.setMetaData(metaElements); se.setElement(element); proxy.setModel(se); if (viewModel.location != null) { Location l = new Location(); if (proxy.getModel().getRowGuid() == null) proxy.getModel().setRowGuid(); l.setName(proxy.getModel().getRowGuid()); LocationProxy lp = LocationService.createPointFromLocation(viewModel.location, l); proxy.setLocation(lp); } return proxy; }