Adds repository pattern. Fixes save from previous feature.