Moved alert/task logic to model