Add state_machine to Tasks and fix mass assignment in tasks_controller_test