Repository class based on http://balmikighosh.blogspot.com/2012/03/creating-repository-pattern-with-entity.html