pulled out common logic from edit and create methods