Is it possible for either of these IDs (or the objects containing them) to be null/undefined?  If so, you may want to include some additional checking.