updated tests for mediaResourceRepository and improved original class.