consider foreign key references also

Signed-off-by: Chirayu Chiripal <chirayu.chiripal@gmail.com>