         }
     }
     
-    static func revertProblem(_ database: Database) throws {
-        try database.delete(Problem.self)
+    static func revert(_ database: Database) throws {
+        try database.delete(self)
     }
     
-    static func prepareProblemCase(_ database: Database) throws {
-        try database.create(ProblemCase.self) { builder in
+}
+
+extension ProblemCase: Preparation {
+    
+    static func prepare(_ database: Database) throws {
+        try database.create(self) { builder in
             builder.id()
             builder.string("input")
             builder.string("output")

        }
    }
    
    static func revertEventProblem(_ database: Database) throws {
        try database.delete(EventProblem.self)
    }
    
    static func prepareProblem(_ database: Database) throws {
        try database.create(Problem.self) { builder in
            builder.id()
            builder.string("name")
            builder.text("description")

        }
    }
    
    static func revert(_ database: Database) throws {
        try database.delete(self)
    }
    
}

extension EventProblem: Preparation {
    
    static func prepare(_ database: Database) throws {
        try database.create(self) { builder in
            builder.id()
            builder.parent(Event.self, optional: false)
            builder.parent(Problem.self, optional: false)
