public boolean assignStockToAssetClass(String stockSymbol, Integer assetClassId) {
    AssetClassStock link = AssetClassStock.create(assetClassId, stockSymbol);

    AssetClassStockRepository repo = new AssetClassStockRepository(context);
    boolean success = repo.insert(link);

    if (!success) {
      ExceptionHandler handler = new ExceptionHandler(context, this);
      handler.showMessage(context.getString(R.string.error));
    }
    return success;
  }
  private void loadStocks(AssetClass assetClass) {
    if (assetClass.getChildren().size() > 0) {
      // Group. Load values for child elements.
      for (AssetClass child : assetClass.getChildren()) {
        loadStocks(child);
      }
    } else {
      // No child elements. This is the actual allocation. Load value from linked stocks.

      assetClass.setType(ItemType.Allocation);

      // load stock links
      AssetClassStockRepository linkRepo = new AssetClassStockRepository(this.context);
      List<AssetClassStock> links = linkRepo.loadForClass(assetClass.getId());
      assetClass.setStockLinks(links);

      if (assetClass.getStockLinks().size() == 0) return;

      //            String[] symbols = Queryable.from(assetClass.getStockLinks())
      //                .map(new Converter<AssetClassStock, String>() {
      //                    @Override
      //                    public String convert(AssetClassStock element) {
      //                        return element.getStockSymbol();
      //                    }
      //                }).toArray();

      int size = assetClass.getStockLinks().size();
      String[] symbols = new String[size];
      for (int i = 0; i < size; i++) {
        AssetClassStock link = assetClass.getStockLinks().get(i);
        symbols[i] = link.getStockSymbol();
      }

      StockRepository stockRepo = new StockRepository(getContext());
      List<Stock> stocks = stockRepo.loadForSymbols(symbols);
      assetClass.setStocks(stocks);
    }
  }