Switch from old ORM to new ORM + some more changes in schema implementation

DO NOT MERGE this request! Its purpose is to outline and review the changes, it can not be used.
Also, it only can be compiled for Android platform.