Check if a row needs to be updated in google spreadsheet
===

I am using Google scripts (JavaScript) to manipulate data in a spreadsheet. What I am trying to accomplish is copying/updating rows from a master sheet to other sheets. I have the copying of rows working correctly and making sure that no duplicates are written.

What I need to do now is that when a row is updated on the mastersheet that the corresponding row is updated on the other sheet. 

Currently I am looping through the dataRange on the other sheet and comparing the value of the row that is being passed from the master sheet that is either to be written (if it doesn't match any of the existing rows) or updated.

    for (i=0; i < objects.length; ++i)
    {
     var dataToCompare = objects[i];
    
     if (dataToInsert.Task == dataToCompare.Task 
        && dataToInsert.coreValue == dataToCompare.coreValue 
        && dataToInsert.assignedTo == dataToCompare.assignedTo
        && dataToInsert.assignedDate == dataToCompare.assignedDate
        && dataToInsert.dueDatetime == dataToCompare.dueDatetime
        && dataToInsert.description == dataToCompare.description
        && dataToInsert.location == dataToCompare.location
        && dataToInsert.completionDate == dataToCompare.completionDate
        && dataToInsert.status == dataToCompare.status
       )
     {
       alreadyExists = true;
       break;
     }
     if (dataToInsert.Task == dataToCompare.Task 
        && dataToInsert.coreValue == dataToCompare.coreValue 
        && dataToInsert.assignedTo == dataToCompare.assignedTo
        && dataToInsert.description == dataToCompare.descriptions
        )
     {
       updateTask = true;
       //Update task
      
       if (dataToInsert.task != "" && dataToInsert.task != null)
       {
         destSheetObject.getRange(rowNum, 1, 1, 1).setValue(dataToInsert.task);
       }
       if (dataToInsert.coreValue != "" && dataToInsert.coreValue != null)
       {
         destSheetObject.getRange(rowNum, 2, 1, 1).setValue(dataToInsert.coreValue);
       }
       if (dataToInsert.assignedTo != "" && dataToInsert.assignedTo != null)
       {
        destSheetObject.getRange(rowNum, 3, 1, 1).setValue(dataToInsert.assignedTo);
       }
       if (dataToInsert.assignedDate != "" && dataToInsert.assignedDate != null)
       {
        destSheetObject.getRange(rowNum, 4, 1, 1).setValue(dataToInsert.assignedDate);
       }
       if (dataToInsert.dueDatetime != "" && dataToInsert.dueDatetime != null)
       {
        destSheetObject.getRange(rowNum, 5, 1, 1).setValue(dataToInsert.dueDatetime);
       }
       if (dataToInsert.description != "" && dataToInsert.description != null)
       {
        destSheetObject.getRange(rowNum, 6, 1, 1).setValue(dataToInsert.description);
       }
       if (dataToInsert.location != "" && dataToInsert.location != null)
       {
        destSheetObject.getRange(rowNum, 7, 1, 1).setValue(dataToInsert.location);
       }
       if (dataToInsert.completionDate != "" && dataToInsert.completionDate != null)
       {
        destSheetObject.getRange(rowNum, 8, 1, 1).setValue(dataToInsert.completionDate);
       }
       if (dataToInsert.status != "" && dataToInsert.status != null)
       {
        destSheetObject.getRange(rowNum, 9, 1, 1).setValue(dataToInsert.status);
       }
       break;
     }
    }
I am not sure what is happening but when I have a row that is to be updated it doesn't fall into the other if statement to check what I have designated as unique identifying keys.

Is there something that I am missing?