Log user activity into a database