REVIEW-3385: Support proper duplication handling for dependency elements. Additional unit test coverage.