Index: trunk/grails-app/services/CreateDataService.groovy
===================================================================
--- trunk/grails-app/services/CreateDataService.groovy	(revision 181)
+++ trunk/grails-app/services/CreateDataService.groovy	(revision 182)
@@ -9,5 +9,5 @@
     boolean transactional = false
 
-    def authenticateService
+    def personService
     def taskService
 
@@ -151,5 +151,5 @@
         //Person
         def passClearText = "pass"
-        def passwordEncoded = authenticateService.encodePassword(passClearText)
+        def passwordEncoded = personService.encodePassword(passClearText)
         def personInstance
 
@@ -168,5 +168,5 @@
         //Person
         def passClearText = "pass"
-        def passwordEncoded = authenticateService.encodePassword(passClearText)
+        def passwordEncoded = personService.encodePassword(passClearText)
         def personInstance
 
@@ -200,5 +200,5 @@
         //Person
         def passClearText = "pass"
-        def passwordEncoded = authenticateService.encodePassword(passClearText)
+        def passwordEncoded = personService.encodePassword(passClearText)
         def personInstance
 
Index: trunk/grails-app/services/PersonService.groovy
===================================================================
--- trunk/grails-app/services/PersonService.groovy	(revision 182)
+++ trunk/grails-app/services/PersonService.groovy	(revision 182)
@@ -0,0 +1,26 @@
+/* Provides a service class with some methods that integrate the Person domain class and Acegi security.
+ *
+ */
+class PersonService {
+
+    boolean transactional = false
+
+    def authenticateService
+
+    // Get current user as a Person and in a safe way to avoid a null userDomain during bootstrap.
+    def currentUser() {
+        if(authenticateService.userDomain()) {
+            return Person.get(authenticateService.userDomain().id)
+        }
+        else {
+            //println "Warning: userDomain not active yet, attempting to return Person #1"
+            return Person.get(1)
+        }
+    }
+
+    // Convenience wrapper.
+    def encodePassword(passClearText) {
+        authenticateService.encodePassword(passClearText)
+    }
+
+}
Index: trunk/grails-app/services/TaskService.groovy
===================================================================
--- trunk/grails-app/services/TaskService.groovy	(revision 181)
+++ trunk/grails-app/services/TaskService.groovy	(revision 182)
@@ -4,5 +4,5 @@
 
     def dateUtilService
-    def authenticateService
+    def personService
 
     def create(params) {
@@ -14,10 +14,6 @@
             result.taskInstance = taskInstance
 
-            // Get person in a safe way to avoid a null userDomain during bootstrap.
-            def userDomain = authenticateService.userDomain()
-            def person = userDomain ? Person.get(userDomain.id) : Person.get(1)
-
             if(taskInstance.save()) {
-                def taskModification = new TaskModification(person:person,
+                def taskModification = new TaskModification(person: personService.currentUser(),
                                                         taskModificationType: TaskModificationType.get(1),
                                                         task: taskInstance)
@@ -64,5 +60,5 @@
 
                 if(result.taskInstance.save()) {
-                    def taskModification = new TaskModification(person:Person.get(authenticateService.userDomain().id),
+                    def taskModification = new TaskModification(person:personService.currentUser(),
                                                             taskModificationType: TaskModificationType.get(3),
                                                             task: result.taskInstance)
@@ -107,5 +103,5 @@
 
                 if(result.taskInstance.save()) {
-                    def taskModification = new TaskModification(person:Person.get(authenticateService.userDomain().id),
+                    def taskModification = new TaskModification(person:personService.currentUser(),
                                                             taskModificationType: TaskModificationType.get(4),
                                                             task: result.taskInstance)
@@ -150,5 +146,5 @@
 
                 if(result.taskInstance.save()) {
-                    def taskModification = new TaskModification(person:Person.get(authenticateService.userDomain().id),
+                    def taskModification = new TaskModification(person:personService.currentUser(),
                                                             taskModificationType: TaskModificationType.get(5),
                                                             task: result.taskInstance)
@@ -193,5 +189,5 @@
 
                 if(result.taskInstance.save()) {
-                    def taskModification = new TaskModification(person:Person.get(authenticateService.userDomain().id),
+                    def taskModification = new TaskModification(person:personService.currentUser(),
                                                             taskModificationType: TaskModificationType.get(6),
                                                             task: result.taskInstance)
@@ -236,5 +232,5 @@
 
                 if(result.taskInstance.save()) {
-                    def taskModification = new TaskModification(person:Person.get(authenticateService.userDomain().id),
+                    def taskModification = new TaskModification(person:personService.currentUser(),
                                                             taskModificationType: TaskModificationType.get(7),
                                                             task: result.taskInstance)
@@ -279,5 +275,5 @@
 
                 if(result.taskInstance.save()) {
-                    def taskModification = new TaskModification(person:Person.get(authenticateService.userDomain().id),
+                    def taskModification = new TaskModification(person:personService.currentUser(),
                                                             taskModificationType: TaskModificationType.get(8),
                                                             task: result.taskInstance)
@@ -322,5 +318,5 @@
 
                 if(result.taskInstance.save()) {
-                    def taskModification = new TaskModification(person:Person.get(authenticateService.userDomain().id),
+                    def taskModification = new TaskModification(person:personService.currentUser(),
                                                             taskModificationType: TaskModificationType.get(9),
                                                             task: result.taskInstance)
