public async Task <IActionResult> UpdateArtists([FromBody] IEnumerable <ArtistUpdateRequest> putRequest) { try { var puts = _mapper.Map <IEnumerable <ArtistModel> >(putRequest); var notExist = await _artistService.ArtistsNotExistAsync(puts); if (notExist.Count() > 0) { var notExistingNames = notExist.Select(x => x.Name).ToList(); return(NotFound(new ErrorResponse(ErrorMessages.Artist.DoesNotExistBulk, notExistingNames))); } var exist = await _artistService.ArtistNamesExistsAsync(puts); if (exist.Count() > 0) { var existingNames = exist.Select(x => x.Name).ToList(); return(BadRequest(new ErrorResponse(ErrorMessages.Artist.NameExistsBulk, existingNames))); } var artists = await _artistService.UpdateArtistsAsync(puts); return(Ok(new Response <IEnumerable <ArtistResponse> >(_mapper.Map <IEnumerable <ArtistResponse> >(artists)))); } catch (Exception ex) { if (ex.GetType() == typeof(DbUpdateConcurrencyException)) { return(StatusCode(StatusCodes.Status500InternalServerError, new ErrorResponse(ErrorMessages.Artist.ConcurrencyIssueBulk))); } return(StatusCode(StatusCodes.Status500InternalServerError, ErrorMessages.Artist.FailedUpdateBulk)); } }