PortfolioSearchResult portSearchResult = getToolContext().getPortfolioMaster().search(portfolioSearchRequest);
for (PortfolioDocument portfolioDocument : portSearchResult.getDocuments()) {
DeletingPortfolioCopier deletingPortfolioCopier =
new DeletingPortfolioCopier(
getToolContext().getSecurityMaster(),
getToolContext().getPositionMaster(),
getCommandLine().hasOption(WRITE_OPT));
deletingPortfolioCopier.copy(
new MasterPortfolioReader(
portfolioDocument.getPortfolio().getName(),
getToolContext().getPortfolioMaster(),
getToolContext().getPositionMaster(),
getToolContext().getSecuritySource()),