public int CreateSong(CreateSongRequest request) { Require.NotNull(request, nameof(request)); Artist artist = _musicRepository.GetArtists(a => a.Name.Equals(request.Artist)).SingleOrDefault(); if (artist == null) { throw new AccountAlreadyExistsException("Artist not found"); } var newSong = new Song( request.Name, request.Text, artist); var songId = _musicRepository.CreateSong(newSong); return(songId); }