post index add and edit functionality with factory method impleneted