Optimized the Entity Framework repository code.