Finished first round of optimisations.

Added optimisations on this commit:
 -> ClassState is not on datastore. It creates DeviceMultiIndexes (one table per each). Default : one more table. Allows individual accesses instead of entire table.
-> DeviceUniqueIndex avoids inserting same entity again