Repository pattern

Implemented repository pattern