Form: Insert optional fields

Hey,
I have a custom form on my page.

Here’s a code example:

 var toInsert = {
 "fieldKey1": $w('#input1').value,
 "fieldKey2": $w('#input2').value
    };

 if ($w('#dropdown2').value === 'Yes') {
 let optional = {
 "optionalBooleanFieldKey": true,
 "optionalImageURL": "https://static.wixstatic.com/media/....jpg"
        }
        toInsert = toInsert && optional ;
    }

 if (Country === "DropdownValue") {
 return wixData.insert("Items", toInsert)
            .then((results) => {
 let item = results;
                console.log("Successfully!");
            });
    }

I want to automate the entries a little bit.
So if the value of “dropdown2” is ‘Yes’, I want to insert some more data (let optional).

“optionalBooleanFieldKey” checks a boolean field in the database.
“optionalImageURL” inserts a specific image.

So I would need a code, that inserts more data, if the value of “dropdown2” is ‘Yes’