A helpful function to find object index by one of its properties