Implement dao and take some tests for this