Write validation helpers 

sub fill_in_form {
    my($form_data, %opt) = @_;

    # Handle records from DBIx::Class
    if( UNIVERSAL::can($form_data, 'get_inflated_columns') ) {
        $form_data = { $form_data->get_inflated_columns };
    }
    elsif( not UNIVERSAL::isa($form_data, 'HASH') ) {
        die "fill_in_form() requires a hashref of form values";
    }

    $global{fill_in_values} = $form_data;
    $global{fill_in_opt}    = \%opt;
}