public async Task AttachGenreToMovie(int movieId, int genreId) { if (!await _movieRepository.IsMovieExists(movieId)) { throw new MovieNotFound("Movie not found!"); } if (!await _genreRepository.IsGenreExists(genreId)) { throw new GenreNotFound("Genre not found!"); } if (await _movieGenreRepository.IsGenreAlreadyAttachedToMovie(movieId, genreId)) { throw new GenreAlreadyAttachedToMovie("Genre already attached to this movie!"); } await _movieGenreRepository.Create(new MovieGenre { MovieId = movieId, GenreId = genreId }); }