Transitioned from file state to DB state

Managing states are now made with a DB.
Fixes on the file state manager.

Change-Id: I89bef295bfec965c06ce7df75fc6fb5cf87f6f57