private Media ViewModelToMedia(MediaViewModel model) { Media m = model.Media; m.ActorActs = new List <ActorAct>(); foreach (string name in model.Actors) { ActorAct aa = new ActorAct(); if (!_actorManager.Exists(name)) { aa.Actor = new Actor { Name = name }; aa.Media = m; } else { aa.Actor = _actorManager.GetByName(name); } aa.Media = m; m.ActorActs.Add(aa); } return(m); }