// GET: Candidates
        public async Task <IActionResult> Index(int pageIndex = 1, int pageSize = 10, string searchQuery = null)
        {
            IQueryable <Candidate> recruiterAgencyContext = _context.Candidates
                                                            .Include(c => c.Department)
                                                            .ThenInclude(x => x.City);

            if (!string.IsNullOrWhiteSpace(searchQuery))
            {
                recruiterAgencyContext = recruiterAgencyContext.Where(x =>
                                                                      x.FirstName.Contains(searchQuery) ||
                                                                      x.LastName.Contains(searchQuery) ||
                                                                      x.Department.City.Name.Contains(searchQuery) ||
                                                                      x.Department.Address.Contains(searchQuery) ||
                                                                      x.PhoneNumber.Contains(searchQuery) ||
                                                                      x.Email.Contains(searchQuery));
            }

            var paginated = await Paginated <Candidate> .PaginateAsync(recruiterAgencyContext, pageIndex, pageSize);

            paginated.SearchQuery = searchQuery;

            return(View(await recruiterAgencyContext.ToListAsync()));
        }