public void AddDirector(DirectorAdd newItem)
        {
            Director director = Mapper.Map<Director>(newItem);

            try
            {
                if (newItem.MovieId.Count != 0)
                {
                    foreach (var item in newItem.MovieId.ToList())
                    {
                        director.Movies.Add(dc.Movies.Find(item));
                        dc.Movies.Find(item).Director = director;
                    }

                }

                //
                dc.Directors.Add(director);
                //
                dc.SaveChanges();
            }
            catch (System.NullReferenceException)
            {
                dc.Directors.Add(director);
            }
            dc.SaveChanges();
        }
 public ActionResult Create(DirectorAdd newItem)
 {
     if (newItem == null)
     {
         return HttpNotFound();
     }
     else
     {
         dir.AddDirector(newItem);
         return View("Index", dir.GetDirectorsForList());
     }
 }