/// <summary>
        /// Method <c>SetUpTestData</c> load the view model with temporary data.
        /// </summary>
        private void SetUpTestData()
        {
            //  Set up some book data;
            BookViewModel book = new BookViewModel()
            {
                UniqueId = "Book 1",
                Author = "Adam Freeman",
                Title = "Pro ASP.NET MVC 3 Framework",
                ISBN = "123456789",
                Synopsis = "A damn good book",
                Keywords = new ObservableCollection<string>() {
                    ".NET", "MVC"
                }
            };
            book.SetImage("Assets/Logo.png");
            this.AllBooks.Add(book);

            book = new BookViewModel()
            {
                UniqueId = "Book 2",
                Author = "Scott Millett",
                Title = "ASP.NET Design Patterns",
                ISBN = "234567890",
                Synopsis = "Excellent and extremely well documented examples",
                Keywords = new ObservableCollection<string>() {
                    ".NET", "MVC", "Patterns"
                }
            };
            book.SetImage("Assets/Logo.png");
            this.AllBooks.Add(book);

            book = new BookViewModel()
            {
                UniqueId = "Book 3",
                Author = "Mark Seemann",
                Title = "Dependency Injection in .NET",
                ISBN = "345678901",
                Synopsis = "All you really need to know about DI, except MVC4",
                Keywords = new ObservableCollection<string>() {
                    ".NET", "DI", "Patterns"
                }
            };
            book.SetImage("Assets/Logo.png");
            this.AllBooks.Add(book);

            //  Set up some previous searches
            SearchViewModel search = new SearchViewModel()
            {
                UniqueId = "Search 1",
                SearchDate = "01/12/2012",
                SearchString = ".NET|MVC",
                Type = "Keyword"
            };
            this.AllSearches.Add(search);

            search = new SearchViewModel()
            {
                UniqueId = "Search 2",
                SearchDate = "02/12/2012",
                SearchString = "Adam Freeman",
                Type = "Author"
            };
            this.AllSearches.Add(search);

            search = new SearchViewModel()
            {
                UniqueId = "Search 3",
                SearchDate = "01/12/2012",
                SearchString = "Pro ASP.NET MVC 3 Framework",
                Type = "Title"
            };
            this.AllSearches.Add(search);

            //  Set up the search Types and corresponding values
            SearchTypesViewModel type = new SearchTypesViewModel()
            {
                Type = "Select a Type...",
                Values = new ObservableCollection<string>()
                {
                    " "
                }
            };
            this.CurrentSearch.SearchTypes.Add(type);
            this.SearchTypes.Add(type);

            type = new SearchTypesViewModel()
            {
                Type = "Author",
                Values = new ObservableCollection<string>()
                {
                    "Select an Author..", "Adam Freeman", "Scott Millett", "Mark Seemann"
                }
            };
            this.CurrentSearch.SearchTypes.Add(type);
            this.SearchTypes.Add(type);

            type = new SearchTypesViewModel()
            {
                Type = "Keyword",
                Values = new ObservableCollection<string>()
                {
                    "Select a Keyword..", ".NET", "MVC", "Patterns", "DI"
                }
            };
            this.CurrentSearch.SearchTypes.Add(type);
            this.SearchTypes.Add(type);

            type = new SearchTypesViewModel()
            {
                Type = "ISBN",
                Values = new ObservableCollection<string>()
                {
                    "Select an Isbn..", "123456789", "234567890", "345678901"
                }
            };
            this.CurrentSearch.SearchTypes.Add(type);
            this.SearchTypes.Add(type);

            type = new SearchTypesViewModel()
            {
                Type = "Title",
                Values = new ObservableCollection<string>()
                {
                    "Select a Title..",
                    "Pro ASP.NET MVC 3 Framework",
                    "ASP.NET Design Patterns",
                    "Dependency Injection in .NET"
                }
            };
            this.CurrentSearch.SearchTypes.Add(type);
            this.SearchTypes.Add(type);

            //  Set the curent search as the first one
            this.CurrentSearch.UniqueId = this.AllSearches[0].UniqueId;
            this.CurrentSearch.Type = this.AllSearches[0].Type;
            this.CurrentSearch.SearchString = this.AllSearches[0].SearchString;
            this.CurrentSearch.SearchDate = this.AllSearches[0].SearchDate;
            this.CurrentSearch.SelectedTypeIndex = 1;
            this.CurrentSearch.SelectedTypeValueIndex = -1;     //  Reset so the next update shows
            this.CurrentSearch.SelectedTypeValueIndex = 0;      //  Update the value drop down.
        }
        /// <summary>
        /// Method <c>LoadData</c> is called to load the view model with the data
        /// from the underlying Data Model, via the repositories, which access
        /// the underlying Data Model.
        /// </summary>
        private void LoadData()
        {
            //  Load _allBooks      (LibraryRepository)
            var allBooks = _libraryRepository.GetAllBooks();
            //  Process each indiviually to ensure the UI observable stuff is updated.
            foreach (var book in allBooks)
            {
                this.AllBooks.Add(MapLibraryBookToBookViewModel.Map(book));
            }

            //  Load _allSearches   (SearchRepository)
            var allSearches = _searchRepository.GetSearches();
            foreach (var search in allSearches)
            {
                this.AllSearches.Add(MapSearchCriteriaToSearchViewModel.Map(search));
            }

            var searchTypes = _searchRepository.GetSearchTypes();
            foreach (var searchType in searchTypes)
            {
                //  Create a SearchTypeViewModel
                SearchTypesViewModel typeVM = new SearchTypesViewModel()
                {
                    Type = searchType,
                    Values = new ObservableCollection<string>()
                };

                //  Add a "Select" message as the first value for the search Type.
                //  TODO: Correct the Grammer for this function, select An Author, Select a Keyword.
                if (searchType == "SearchString")
                    typeVM.Values.Add(string.Format("Type a value into the search string"));
                else
                    typeVM.Values.Add(string.Format("Select a {0}....", searchType));

                //  Get the possible values from the library.
                var values = _libraryRepository.GetSearchableBookValues(searchType);
                //  Add each possible value into the SearchTypesViewModel
                foreach (var val in values)
                {
                    typeVM.Values.Add(val);
                }

                //  Add the SearchType to the view model
                this.CurrentSearch.SearchTypes.Add(typeVM);
                this.SearchTypes.Add(typeVM);
            }

            //  Load _currentSearch (item 0 of the searches loaded, if there are any)
            if (this.AllSearches.Count() == 0)
            {
                //  set to new search
                this.CurrentSearch.UniqueId = string.Empty;
                this.CurrentSearch.Type = _searchTypes[0].Type;
                this.CurrentSearch.SearchString = string.Empty;
                this.CurrentSearch.SearchDate = DateTime.Now.ToString();
                this.CurrentSearch.SelectedTypeIndex = 0;
                this.CurrentSearch.SelectedTypeValueIndex = 0;
            }
            else
            {
                //  Set to the first search.
                this.CurrentSearch.UniqueId = this.AllSearches[0].UniqueId;
                this.CurrentSearch.Type = this.AllSearches[0].Type;
                this.CurrentSearch.SearchString = this.AllSearches[0].SearchString;
                this.CurrentSearch.SearchDate = this.AllSearches[0].SearchDate;
                int idx = this.SearchTypes.IndexOf(new SearchTypesViewModel() { Type = this.CurrentSearch.Type });
                this.CurrentSearch.SelectedTypeIndex = idx;
                this.CurrentSearch.SelectedTypeValueIndex = 0;
            }

            //  Set the default sort sequence for display, which is by Title
            this._currentSortSequence = BookSortEnum.Title;
        }