function _createsCircularReference($subject_to_embed, $subject_stack) {
    for($i = count($subject_stack) - 1; $i >= 0; --$i) {
      if($subject_stack[$i]->{'@id'} === $subject_to_embed->{'@id'}) {
        return true;
      }
    }
    return false;
  }