protected override List <RefLink> SelectReferences(IProgressObserver progress)
        {
            var service     = new SupportService(User);
            var taxaService = new TaxaService(User);

            if (progress != null)
            {
                progress.ProgressMessage("Retrieving Reference links...");
            }
            var reflinks = service.GetReferenceLinks(TraitCategoryType.Taxon.ToString(), Taxon.TaxaID.Value);

            if (Options.IncludeChildReferences == true)
            {
                var children = taxaService.GetExpandFullTree(Taxon.TaxaID.Value);

                var elementCount = 0;
                int total        = children.Count;

                if (progress != null)
                {
                    progress.ProgressStart("Extracting references for children...");
                }

                foreach (Taxon child in children)
                {
                    if (progress != null)
                    {
                        double percent = (((double)elementCount) / ((double)total)) * 100.0;
                        progress.ProgressMessage(string.Format("Processing {0}", child.TaxaFullName), percent);
                    }
                    elementCount++;

                    var links = service.GetReferenceLinks(TraitCategoryType.Taxon.ToString(), child.TaxaID.Value);
                    foreach (RefLink link in links)
                    {
                        reflinks.Add(link);
                    }
                }

                if (progress != null)
                {
                    progress.ProgressEnd("");
                }
            }

            return(reflinks);
        }
        private DataMatrix AddMediaForTaxon(int taxonId, IProgressObserver progress)
        {
            var results = new DataMatrix();

            results.Columns.Add(new MatrixColumn {
                Name = "MultimediaID", IsHidden = true
            });
            results.Columns.Add(new MatrixColumn {
                Name = "TaxonID", IsHidden = true
            });
            results.Columns.Add(new MatrixColumn {
                Name = "MultimediaLink", IsHidden = true
            });
            results.Columns.Add(new MatrixColumn {
                Name = "Taxon name"
            });
            results.Columns.Add(new MatrixColumn {
                Name = "Rank"
            });
            results.Columns.Add(new MatrixColumn {
                Name = "Multimedia Name"
            });
            results.Columns.Add(new MatrixColumn {
                Name = "Extension"
            });
            results.Columns.Add(new MatrixColumn {
                Name = "Multimedia Type"
            });
            results.Columns.Add(new MatrixColumn {
                Name = "Size"
            });
            results.Columns.Add(new MatrixColumn {
                Name = "Attached To"
            });
            results.Columns.Add(new MatrixColumn {
                Name = "MaterialID", IsHidden = true
            });

            if (progress != null)
            {
                progress.ProgressMessage("Extracting multimedia details for item...");
            }

            // First add the multimedia for this item
            var links = SupportService.GetMultimediaItems(TraitCategoryType.Taxon.ToString(), taxonId);
            var taxon = TaxaService.GetTaxon(taxonId);

            foreach (MultimediaLink link in links)
            {
                AddTaxonRow(results, taxon, link);
            }

            if (_includeMaterial)
            {
                AddMaterialRowsForTaxon(results, taxon);
            }

            if (_recurse)
            {
                // Now find all the children of this item
                if (progress != null)
                {
                    progress.ProgressMessage("Retrieving child items...");
                }

                var children = TaxaService.GetExpandFullTree(taxonId);

                var elementCount = 0;
                int total        = children.Count;

                if (progress != null)
                {
                    progress.ProgressStart("Extracting multimedia for children...");
                }

                foreach (Taxon child in children)
                {
                    if (progress != null)
                    {
                        double percent = (((double)elementCount) / ((double)total)) * 100.0;
                        progress.ProgressMessage(string.Format("Processing {0}", child.TaxaFullName), percent);
                    }
                    elementCount++;

                    links = SupportService.GetMultimediaItems(TraitCategoryType.Taxon.ToString(), child.TaxaID.Value);
                    foreach (MultimediaLink link in links)
                    {
                        AddTaxonRow(results, child, link);
                    }

                    if (_includeMaterial)
                    {
                        AddMaterialRowsForTaxon(results, child);
                    }
                }
            }

            if (progress != null)
            {
                progress.ProgressEnd(string.Format("{0} multimedia items found.", results.Rows.Count));
            }


            return(results);
        }