public void Add(ArtistModel artistModel) { if (string.IsNullOrEmpty(artistModel.Name)) { throw new ValidationException(Messages.ArtistNameRequired); } if (string.IsNullOrEmpty(artistModel.Description)) { throw new ValidationException(Messages.ArtistDescriptionRequired); } var artistByName = _artistRepository.GetByName(artistModel.Name); if (artistByName != null) { throw new ConflictException(Messages.ArtistNameAlreadyExists); } var artist = ArtistMapper.ToArtist(artistModel); artist.Id = SecurityUtils.GenerateEntityId(); _artistRepository.Add(artist); }