/// <inheritdoc />
        public async Task <MementoResponse> UpdateAsync(long movieId, MovieFormContract movie)
        {
            // Invoke the API
            var response = await this.HttpService.PutAsync($"{API_URL}{movieId}", movie);

            if (!response.Success)
            {
                throw new ApplicationException(string.Join(Environment.NewLine, response.Errors));
            }
            else
            {
                return(response);
            }
        }
        /// <inheritdoc />
        public async Task <MementoResponse <MovieDetailContract> > CreateAsync(MovieFormContract movie)
        {
            // Invoke the API
            var response = await this.HttpService.PostAsync <MovieFormContract, MovieDetailContract>($"{API_URL}", movie);

            if (!response.Success)
            {
                throw new ApplicationException(string.Join(Environment.NewLine, response.Errors));
            }
            else
            {
                return(response);
            }
        }
        public async Task <ActionResult <MementoResponse <MovieDetailContract> > > CreateAsync([FromBody] MovieFormContract contract)
        {
            // Check if there's a picture in the contract
            if (contract.Picture == null)
            {
                // Get the field name
                var name = this.Localizer.GetString(SharedResources.MOVIE_PICTURE);

                // Create the message with the given context
                var message = this.Localizer.GetString(SharedResources.ERROR_INVALID_FIELD, name);

                // Throw an exception due to the missing picture
                throw new MementoException(message, MementoExceptionType.BadRequest);
            }

            // Map the movie
            var movie = this.Mapper.Map <Movie>(contract);

            // Create the picture in the storage
            movie.PictureUrl = await this.Storage.CreateAsync(contract.Picture.FileBase64, contract.Picture.FileName);

            // Create the movie
            var createdMovie = await this.Repository.CreateAsync(movie);

            // Build the response
            return(this.BuildCreateResponse <Movie, MovieDetailContract>(createdMovie));
        }
        public async Task <ActionResult <MementoResponse> > UpdateAsync([FromRoute] long id, [FromBody] MovieFormContract contract)
        {
            // Map the movie
            var movie = this.Mapper.Map <Movie>(contract);

            movie.Id = id;

            // Check if there's a picture in the contract
            if (contract.Picture != null)
            {
                // Create the picture in the storage
                movie.PictureUrl = await this.Storage.CreateAsync(contract.Picture.FileBase64, contract.Picture.FileName);
            }
            else
            {
                movie.PictureUrl = (await this.Repository.GetAsync(id)).PictureUrl;
            }

            // Update the movie
            await this.Repository.UpdateAsync(movie);

            // Build the response
            return(this.BuildUpdateResponse());
        }