public async Task EditPost(ActorEditDto actor)
        {
            var editedActor = _mapper.Map <Actor>(actor);
            await _actorRepository.Update(editedActor);

            await _actorRepository.UploadImage(actor.ImageFile, editedActor);

            var movieActors = await _movieActorRepository.Search(ma => ma.ActorId == editedActor.Id);

            foreach (var ma in movieActors)
            {
                await _movieActorRepository.Remove(ma);
            }

            foreach (var movie in actor.MovieIds)
            {
                await _movieActorRepository.Add(new MovieActor()
                {
                    MovieId = movie, ActorId = editedActor.Id
                });
            }

            //foreach (var movie in actor.MovieIds)
            //{
            //    var newMovieActor = new MovieActor()
            //    {
            //        MovieId = movie,
            //        ActorId = editedActor.Id
            //    };
            //    await _movieActorRepository.Add(newMovieActor);
            //}                                                                   DO PRZETESTOWANIA Z MAPPEERM
        }
        public async Task EditPost(MovieEditDto movie)
        {
            var editedMovie = _mapper.Map <Movie>(movie);
            await _movieRepository.Update(editedMovie);

            await _movieRepository.UploadImage(movie.ImageFile, editedMovie);

            var movieActors = await _movieActorRepository.Search(ma => ma.MovieId == movie.Id);

            foreach (var ma in movieActors)
            {
                await _movieActorRepository.Remove(ma);
            }

            var movieCategories = await _movieCategoryRepository.Search(mc => mc.MovieId == movie.Id);

            foreach (var mc in movieCategories)
            {
                await _movieCategoryRepository.Remove(mc);
            }


            foreach (var actorId in movie.ActorIds)
            {
                await _movieActorRepository.Add(new MovieActor()
                {
                    ActorId = actorId, MovieId = movie.Id
                });
            }

            foreach (var categoryId in movie.CategoryIds)
            {
                await _movieCategoryRepository.Add(new MovieCategory()
                {
                    CategoryId = categoryId, MovieId = movie.Id
                });
            }

            foreach (var newActorDto in movie.NewActors)
            {
                var newActor = _mapper.Map <Actor>(newActorDto);
                await _actorRepository.Add(newActor);

                await _actorRepository.UploadImage(newActorDto.ImageFile, newActor);

                await _movieActorRepository.Add(new MovieActor()
                {
                    MovieId = editedMovie.Id, ActorId = newActor.Id
                });
            }
        }