public async Task <IActionResult> Create(FilmViewModel model, IFormFileCollection posters) { if (!ModelState.IsValid) { return(View(model)); } Film film = new Film { Name = model.Name, Description = model.Description, AgeLimit = model.AgeLimit, ReleaseDate = model.ReleaseDate, Duration = model.Duration }; await _filmRepository.CreateAsync(film); FilmTrailer trailer = new FilmTrailer { Url = model.TrailerUrl, FilmId = film.Id }; await _trailerRepository.CreateAsync(trailer); film.Trailer = trailer; List <FilmPoster> filmPosters = await SavePostersImages(film.Id, posters); film.Posters.AddRange(filmPosters); await _filmRepository.UpdateAsync(film); return(RedirectToAction("Index", "Admin")); }