public IActionResult Create(SerieCreateViewModel model) { Serie newSerie = new Serie() { Name = model.Name, IsPublic = true }; _mediaService.InsertSerie(newSerie); _mediaService.SaveChanges(); var foundSerie = _mediaService.GetAllSeries().FirstOrDefault(x => x.Id == newSerie.Id); if (model.Photo != null) { using var memoryStream = new MemoryStream(); model.Photo.CopyTo(memoryStream); foundSerie.Photo = memoryStream.ToArray(); } _mediaService.SaveChanges(); return(RedirectToAction("Index")); }