private static void PopulateDb()
        {
            using (var ctx = new ProjectsDbContext())
            {
                User user1 = ctx.Users.Add(new User { Name = "user1" });
                User user2 = ctx.Users.Add(new User { Name = "user2" });
                User user3 = ctx.Users.Add(new User { Name = "user3" });
                User user4 = ctx.Users.Add(new User { Name = "user4" });

                ctx.SaveChanges();

                Project p1 = ctx.Projects.Add(new Project { CreatedBy = user1, ModifiedBy = user3 });
                Project p2 = ctx.Projects.Add(new Project { CreatedBy = user2, ModifiedBy = user4 });

                ctx.Subprojects.Add(new Subproject { Area = 100, Project = p1 });
                ctx.Subprojects.Add(new Subproject { Area = 200, Project = p1 });
                ctx.Subprojects.Add(new Subproject { Area = 350, Project = p2 });
                ctx.Subprojects.Add(new Subproject { Area = 450, Project = p2 });
                ctx.Subprojects.Add(new Subproject { Area = 10000, Project = p2 });

                ctx.SaveChanges();
            }
        }
 private static void ClearDb()
 {
     using (var ctx = new ProjectsDbContext())
     {
         foreach (var subproject in ctx.Subprojects)
         {
             ctx.Subprojects.Remove(subproject);
         }
         foreach (var project in ctx.Projects)
         {
             ctx.Projects.Remove(project);
         }
         foreach (var user in ctx.Users)
         {
             ctx.Users.Remove(user);
         }
         ctx.SaveChanges();
     }
 }