Refactor Dao to hide mysql details
Add logic to compare max_value and max_allowed_value