refactored code for ef code first