Implemented the pattern shown in the answer by MikeSW here: http://stackoverflow.com/questions/21349950/entity-framework-6-code-first-is-repository-implementation-a-good-one