Database writing. Restructure folders