Added saving of manual sort to DB

Also fixed the signature of Database::escape()

Signed-off-by: dradancer <kuba.zarybnicky@post.cz>