Refactored the edit and new form to avoid duplications