Refactor form handling for accepts_nested_attributes_for