move all logic to db operations to DAO class

do not make get request to retrieve all measures when
server returns status code 500

Change-Id: Ie9b2d30c537cee215ee6110eedf5540d4ace70f2