/// <summary>
        /// Get the selected simple and Genre tags and determine if there has been any changes
        /// </summary>
        private void OnOk(MultiSpinner genreSpinner, Spinner tagSpinner)
        {
            // Get the selected record from the Genre spinner. If not all of the items are selected then add an entry for each selected item to a new TagGroup
            List <TagGroup> selectedGroups = new List <TagGroup>();

            if (genreSpinner.SelectionRecord.All(genre => genre) == false)
            {
                TagGroup group = new TagGroup()
                {
                    Name = FilterManagementModel.GenreTags.Name
                };
                selectedGroups.Add(group);

                // Merge the Spinner's selection record and the Genre tags into a single list and then add to the new group any tags that are selected
                IEnumerable <Tuple <bool, Tag> > merged = genreSpinner.SelectionRecord.Zip(FilterManagementModel.GenreTags.Tags, (x, y) => Tuple.Create(x, y));
                group.Tags.AddRange(merged.Where(t => (t.Item1 == true)).Select(t => t.Item2));
            }

            // Get the simple tag
            Tag newTag = (tagSpinner.SelectedItemPosition == 0) ? null : Tags.GetTagByName(tagSpinner.SelectedItem.ToString());

            // Check for simple or group tag changes
            if ((newTag != CurrentlySelectedFilter) || (selectedGroups.Count != CurrentlySelectedTagGroups.Count) ||
                (selectedGroups.Any(group => GroupChanged(group)) == true))
            {
                // Update the FilterManagementModel TagGroups with the possibly updated data from the Adapter
                CurrentlySelectedTagGroups.Clear();
                CurrentlySelectedTagGroups.AddRange(selectedGroups);
                SelectionDelegate?.Invoke(newTag);
            }
        }
        /// <summary>
        /// Determine whether or not the group represents a changed selection
        /// </summary>
        /// <param name="group"></param>
        /// <returns></returns>
        private bool GroupChanged(TagGroup selectedGroup)
        {
            bool selectionChanged = false;

            // Get the matching group in the current selection
            TagGroup existingGroup = CurrentlySelectedTagGroups.SingleOrDefault(tg => tg.Name == selectedGroup.Name);

            // If there is no existing group, or the group size has changed, or there are entries in the new group that are not in the old one
            if ((existingGroup == null) || (selectedGroup.Tags.Count != existingGroup.Tags.Count) ||
                (existingGroup.Tags.Except(selectedGroup.Tags).ToList().Count > 0))
            {
                selectionChanged = true;
            }

            return(selectionChanged);
        }
        /// <summary>
        /// Initialise the contents of the Genre spinner
        /// </summary>
        /// <param name="genreSpinner"></param>
        private void InitialiseGenreSpinner(MultiSpinner genreSpinner)
        {
            // Get the currently selected Genre items from the CurrentlySelectedTagGroups.
            // If there is no Genre TagGroup then all the Genre items are selected.
            // Otherwise only the items in the TagGroup are selected
            bool[] selected = Enumerable.Repeat(true, FilterManagementModel.GenreTags.Tags.Count).ToArray();

            // Is there a Genre TagGroup
            TagGroup genreGroup = CurrentlySelectedTagGroups.FirstOrDefault(group => (group.Name == FilterManagementModel.GenreTags.Name));

            if (genreGroup != null)
            {
                // Set the selected flag for each tag according to whether or not it is in the TagGroup
                for (int genreIndex = 0; genreIndex < FilterManagementModel.GenreTags.Tags.Count; ++genreIndex)
                {
                    selected[genreIndex] = genreGroup.Tags.Exists(tag => tag.Name == FilterManagementModel.GenreTags.Tags[genreIndex].Name);
                }
            }

            // Display the names of all the genre tags in a multi-select spinner
            genreSpinner.SetItems(FilterManagementModel.GenreTags.Tags.Select(ta => ta.Name).ToList(), selected, "All");
        }