public async Task <IActionResult> CreateArtists([FromBody] IEnumerable <ArtistCreateRequest> postRequest) { try { var posts = _mapper.Map <IEnumerable <ArtistModel> >(postRequest); var exist = await _artistService.ArtistNamesExistsAsync(posts); if (exist.Count() > 0) { var existingNames = exist.Select(x => x.Name).ToList(); return(BadRequest(new ErrorResponse(ErrorMessages.Artist.NameExistsBulk, existingNames))); } var artists = await _artistService.CreateArtistsAsync(posts); var locationUri = ApiRoutes.Artists.Route; return(Created(locationUri, new Response <IEnumerable <ArtistResponse> >(_mapper.Map <IEnumerable <ArtistResponse> >(artists)))); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, new ErrorResponse(ErrorMessages.Artist.FailedCreateBulk))); } }