Method for finding index path of an object.