01 - Heat the oven to 375°F. Grease a 9x13 inch baking dish thoroughly.
02 - Boil salted water in a large pot. Add ziti and cook until just al dente, about 2 minutes less than package directions. Drain and set aside.
03 - Heat olive oil in a large skillet over medium heat. Sauté chopped onion until translucent, about 5 minutes. Add minced garlic and cook for another minute.
04 - Stir in crushed tomatoes, tomato paste, oregano, basil, and optional red pepper flakes. Season with salt and pepper. Simmer uncovered for 10 to 15 minutes, stirring occasionally.
05 - In a medium bowl, blend ricotta, egg, Parmesan, and chopped herbs until smooth and evenly mixed.
06 - Return drained pasta to the pot. Fold in half of the tomato sauce and half of the shredded mozzarella cheese until evenly combined.
07 - Spread half of the pasta mixture evenly in the baking dish. Distribute the ricotta cheese mixture over the pasta layer. Top with the remaining pasta mixture, then pour over the remaining sauce. Sprinkle the remaining mozzarella evenly on top.
08 - Cover the dish with foil and bake for 20 minutes.
09 - Remove the foil and bake an additional 10 to 15 minutes until the cheese is golden and bubbling.
10 - Let the dish stand for 10 minutes to set before serving.