implemented repository pattern