/**
  * Converts an element to a StationElementProxy and adds it to the proxy's station elements if an
  * matching element does not already exist.
  *
  * @param proxy the VegetationSurveyProxy (canopy) to add the elements to
  * @param elements the list of elements to add as proxies
  * @return the number of elements added
  */
 public static int addElements(VegetationSurveyProxy proxy, List<Element> elements) {
   if (elements == null || elements.size() < 1) return 0;
   List<StationElementProxy> proxies = proxy.getStationElements();
   if (proxies == null) {
     proxies = ElementService.convertFromElements(elements);
     return proxies.size();
   }
   return CollectionOperations.Merge(
       proxy.getStationElements(),
       ElementService.convertFromElements(elements),
       new StationElementProxy.StationElementProxyByElementRowGuidComparator());
 }
 public static void updateFromViewModels(
     ArrayList<CategoryElementsListAdapter.ViewModel> viewModels,
     List<StationElementProxy> proxies) {
   StationElementProxy.StationElementProxyByRowGuidComparator comparator =
       new StationElementProxy.StationElementProxyByRowGuidComparator();
   List<StationElementProxy> fromVM = CategorySurveyService.convertToProxies(viewModels);
   List<StationElementProxy> forDelete = CollectionOperations.except(proxies, fromVM, comparator);
   if (forDelete != null && forDelete.size() > 0)
     CollectionOperations.removeAll(proxies, forDelete, comparator);
   // PhotoService photoService = new PhotoService(SageApplication.getInstance().getDaoSession());
   for (StationElementProxy proxy : proxies) { // TODO: investigate moving to ElementService
     StationElementProxy temp = CollectionOperations.find(fromVM, proxy, comparator);
     proxy.getModel().setCount(temp.getModel().getCount());
     MetaDataService.MetaSupportExtensionMethods.replace(proxy.getModel(), temp.getModel());
     updateLocationProxy(proxy, temp);
     // TODO: deal with photos
     temp.setPhotos(proxy.getPhotos());
     // List<Photo> photos = photoService.find(proxy.getModel());
     // if(photos != null && photos.size() > 0) proxy.setPhotos(PhotoService.convertToProxy(photos,
     // proxy.getModel()));
   }
 }