Improve code quality.
Fix deadlocking when user action
Now storing activity data into database.