I am running through a set of records using a for each loop, and also doing simple checks to ensure that good data is inserted into a database table. 

Sometimes the dataset can be missing the LegistarID value, the change I need to do in my code, is to add a check for LegistarItem, 

if the value of LegistarID is missing, but the AgendaItem value is not, then assign the value of AgendaItem to LegistarID

if LegistarId is missing, and there is also no AgendaItem value, then return a message to the user, to let them know that these values need to be present in the dataset they are trying to import.

I know it does not sound complex, but I am having a hard time making this change successfully. I need a bit of help if possible, please. 

Here is my code as I currently have it:

```
if (ModelState.IsValid)
{
    using (Etities db = new Entities())
    {
        foreach (var i in meeting)
        {
            if (i.MeetingID == 0)
            {
                message = string.Format("This file is missing the Meeting ID value of at least 1 record. \n Verify that the data you are trying to upload meets the criteria, and then try to upload your file again.", i.MeetingID);
                return new JsonResult { Data = new { status = status, message = message } };
            }
            else
            {
                // development
                var compositeKey = db.MeetingAgenda.Find(i.MeetingID, i.AgendaItem);                               
                if (compositeKey == null)
                {
                    // Add new
                    // development
                    db.MeetingAgenda.Add(i);
                    //
                }
                else
                {
                    // Serves as an update, or addition of a previously imported dataset
                    db.Entry(compositeKey).CurrentValues.SetValues(i.MeetingID);
                    db.Entry(compositeKey).State = EntityState.Modified;
                }
            }
        }
        db.SaveChanges();
        status = true;
    }
}
else
{
    message = string.Format("Please, verify that the file you are trying to upload is correctly formatted, and that the data it contains, meets the expected criteria, then click the upload button again. \n Thank you!");
    return new JsonResult { Data = new { status = status, message = message } };
}

```

I think that part of the code I need is something like this:

```
else if (i.LegistarID == 0 and i.AgendaItem != 0)
{
    i.LegistarID = i.AgendaItem                             
}

```

I just am unsure how in the current code place it.