code: private ResourceAssignment getExistingResourceAssignment(Resource resource)
     {
        ResourceAssignment assignment = null;
        Integer resourceUniqueID = null;
  
        if (resource != null)
        {
           Iterator<ResourceAssignment> iter = m_assignments.iterator();
           resourceUniqueID = resource.getUniqueID();
  
           while (iter.hasNext() == true)
           {
              assignment = iter.next();
              Integer uniqueID = assignment.getResourceUniqueID();
              if (uniqueID != null && uniqueID.equals(resourceUniqueID) == true)
              {
                 break;
              }
              assignment = null;
           }
        }
  
        return assignment;
     }
docs: Retrieves an existing resource assignment if one is present,
  to prevent duplicate resource assignments being added.
  
  @param resource resource to test for
  @return existing resource assignment