writing controller, prepare db version