public SongDto UpdateSongById(int songId, SongDto song) { var songEntity = _songRepository.GetById(songId); var mediaRecording = _mediaRecordingRepository.GetById(songEntity.recordingid); if (songEntity == null || mediaRecording == null) { return(song); } songEntity.title = song.Title; mediaRecording.recordingtitle = song.Title; mediaRecording.duration = song.Duration; songEntity.isrc = song.Isrc; mediaRecording.isrc = song.Isrc; songEntity.releasedate = song.ReleaseDate; _mediaRecordingRepository.Update(mediaRecording); _songRepository.Update(songEntity); _unitOfWork.Commit(); return(song); }