public async Task <IActionResult> Edit(int id, string actorSearchName = "")
        {
            //Avoid Null Exception when no search filter passed.
            if (string.IsNullOrEmpty(actorSearchName))
            {
                actorSearchName = "";
            }

            Movie foundMovie = await _movies.GetById(id);


            if (foundMovie != null)
            {
                MovieEditModel viewModel = new MovieEditModel
                {
                    Title       = foundMovie.Title,
                    Id          = foundMovie.Id,
                    Year        = foundMovie.Year,
                    Revenue     = foundMovie.Revenue,
                    Runtime     = foundMovie.Runtime,
                    Description = foundMovie.Description,
                    Director    = foundMovie.Director
                };

                //Build List of Actors
                ICollection <Actor> linkedActors = foundMovie.FilmCasts.Select(filmCast => filmCast.Actor).ToList();
                ICollection <Actor> allActors    = await _actors.GetAllLight();

                List <AssignedEntity> assignedActors = allActors.OrderBy(actor => actor.Name).Where(actor => actor.Name.Contains(actorSearchName))
                                                       .Select(actor => new AssignedEntity
                {
                    Id       = actor.Id,
                    Name     = actor.Name,
                    Assigned = linkedActors.Contains(actor)
                }).ToList();


                viewModel.AssignedActors = assignedActors;


                //Build List of Genres
                ICollection <Genre> linkedGenres = foundMovie.MovieGenres.Select(movieGenre => movieGenre.Genre).ToList();
                ICollection <Genre> allGenres    = await _genres.GetAllLight();

                viewModel.AssignedGenres = allGenres
                                           .Select(genre => new AssignedEntity
                {
                    Id       = genre.Id,
                    Name     = genre.Name,
                    Assigned = linkedGenres.Contains(genre)
                }).ToList();


                await PopulateDirectorDropDownList(foundMovie.Director.Id);

                return(View(viewModel));
            }

            return(NotFound());
        }