code is updated for adding dao layer