public IList<Criminal> GetCriminalsByType(SearchType type, CriminalSearchItem searchItem)
        {
            List<Criminal> records = GetAll().ToList();
            List<Criminal> results;

            switch (type)
            {
                case SearchType.Age:
                    {
                        if (!_inputValidtor.IsValidRange(searchItem.From, searchItem.To))
                            throw new CriminalSearchException("Invalid age range");

                        results = records.Where(x => x.Age >= searchItem.From && x.Age <= searchItem.To).ToList();
                        break;
                    }
                case SearchType.Height:
                    {
                        if (!_inputValidtor.IsValidRange(searchItem.From, searchItem.To))
                            throw new CriminalSearchException("Invalid height range");

                        results = records.Where(x => x.Height >= searchItem.From && x.Height <= searchItem.To).ToList();
                        break;
                    }
                case SearchType.Name:
                    {
                        if (string.IsNullOrWhiteSpace(searchItem.SingleInput) || !_inputValidtor.IsAlphaNumeric(searchItem.SingleInput))
                            throw new CriminalSearchException("Invalid Name");

                        results = records.Where(x => x.Name.ToLower().Contains(searchItem.SingleInput.ToLower())).ToList();
                        break;
                    }
                case SearchType.Nationality:
                    {
                        if (string.IsNullOrWhiteSpace(searchItem.SingleInput) || !_inputValidtor.IsAlphaNumeric(searchItem.SingleInput))
                            throw new CriminalSearchException("Invalid Nationality");

                        results = records.Where(x => x.Nationality.ToLower().Contains(searchItem.SingleInput.ToLower())).ToList();
                        break;
                    }
                case SearchType.Sex:
                    {
                        results = records.Where(x => x.Sex == searchItem.Sex).ToList();
                        break;
                    }
                default:
                    {
                        results = new List<Criminal>();
                        break;
                    }
            }

            return results;
        }
        public IList<Criminal> PopulateSearchList(CriminalSearchViewModel viewmodel)
        {
            CriminalSearchItem searchitem = new CriminalSearchItem();

            if (viewmodel.SearchBy == SearchType.Name || viewmodel.SearchBy == SearchType.Nationality)
            {
                searchitem.SingleInput = viewmodel.SingleInput;
            }
            else
            {
                searchitem.From = viewmodel.Range[0];
                searchitem.To = viewmodel.Range[1];
            }

            return _criminalRepository.GetCriminalsByType(viewmodel.SearchBy, searchitem);
        }