Remved boiler plate code in Dependency visitor