public IList<Entities.Event> RetrieveExercises(IExerciseRepository repository) { //retrieve from cache IList<Event> exercises = ExerciseClient.RetrieveExercises(); if (exercises == null) { //retrieve from database exercises = repository.RetrieveExercises(); //save to cache ExerciseClient.SaveExercises(exercises); } return exercises; }