package Ġru . nik step . alarm . service . data Ċ Ċ import Ġru . nik step . alarm . database . Playlist Dao Ċ import Ġru . nik step . alarm . model . Playlist Ċ Ċ class ĠDatabase Playlist DataService ( ĊĠĠĠ Ġprivate Ġval Ġplaylist Dao : ĠPlaylist Dao Ċ ) Ġ: ĠPlaylist DataService Ġ{ ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun Ġfind ById ( playlist Id : ĠLong ): ĠPlaylist ? Ġ= Ġplaylist Dao . findById ( playlist Id ) ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun ĠfindAll (): ĠList < Playlist > Ġ= Ġplaylist Dao . getAll () ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun Ġsave All ( play lists : ĠList < Playlist >): ĠList < Playlist > Ġ{ ĊĠĠĠĠĠĠĠ Ġplaylist Dao . insert ( play lists ) ĊĠĠĠĠĠĠĠ Ġreturn ĠfindAll () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun Ġcreate OrUpdate ( play lists : ĠList < Playlist >): ĠList < Playlist > Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġstored Play lists Ġ= ĠfindAll (). associate By Ġ{ Ġit . external Id Ġ} ĊĠĠĠĠĠĠĠ Ġreturn Ġsave All ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġplay lists . map Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġplaylist Ġ= Ġstored Play lists [ it . external Id ] Ġ?: Ġreturn @ map Ġit ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġit . copy ( id Ġ= Ġplaylist . id ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun Ġdelete All () Ġ= Ġplaylist Dao . delete All () Ċ }