Avoid crash on csync_ctx is NULL.
Add a recursiveFolderStatus method
Minor cleanups and changes
More descriptive error message when querying the database without hit.