/// <summary>
        /// TODO: Delete this when admin screens done!
        /// </summary>
        public static void TempInit()
        {
            AllProjects t3 = new AllProjects();

            if (t3.Count == 0)
            {
                t3.Add(new Project {
                    Id = Guid.NewGuid(), Description = "Test Project", Active = true
                });
                t3.Save();
            }

            AllTasks t1 = new AllTasks();

            if (t1.Count == 0)
            {
                t1.Add(new Task {
                    Id = Guid.NewGuid(), ProjectId = t3[0].Id, Description = "Test Task 1", Active = true
                });
                t1.Save();
            }

            AllUserTaskAccess t5 = new AllUserTaskAccess();

            if (t5.Count == 0)
            {
                t5.Add(new UserTaskAccess {
                    ProjectId = t3[0].Id, TaskId = t1[0].Id, UserId = new AllUsers()[0].UserId
                });
                t5.Save();
            }
        }
        public static List <ValidationMessage> AddUserAccess(
            ValidatableParameter <string> projectId,
            ValidatableParameter <string> taskId,
            ValidatableParameter <Guid> userId
            )
        {
            List <ValidationMessage> errors = new List <ValidationMessage>();

            Guid projId = Guid.Empty;
            Guid tskId  = Guid.Empty;

            try
            {
                projId = new Guid(projectId.Value);
            }
            catch (FormatException)
            {
                errors.Add(new ValidationMessage {
                    MessageText = "Project Id must be in the format dddddddd-dddd-dddd-dddd-dddddddddddd", Source = projectId.Source
                });
            }

            try
            {
                tskId = new Guid(taskId.Value);
            }
            catch (FormatException)
            {
                errors.Add(new ValidationMessage {
                    MessageText = "Task Id must be in the format dddddddd-dddd-dddd-dddd-dddddddddddd", Source = taskId.Source
                });
            }

            if (userId.Value == Guid.Empty)
            {
                errors.Add(new ValidationMessage {
                    MessageText = "User must be supplied", Source = userId.Source
                });
            }
            else
            {
                //check for existing relationship
                UserTaskAccess existItem = AllUserTaskAccess.GetForUserAndProjectAndTask(userId.Value, projId, tskId);
                if (existItem != null)
                {
                    errors.Add(new ValidationMessage {
                        MessageText = string.Format("User already has access to Task with Id {0}", existItem.TaskId.ToString()), Source = userId.Source
                    });
                }
            }

            //perform add if no errors
            if (errors.Count == 0)
            {
                AllUserTaskAccess items   = new AllUserTaskAccess();
                UserTaskAccess    newItem = new UserTaskAccess {
                    ProjectId = projId, TaskId = tskId, UserId = userId.Value
                };
                items.Add(newItem);

                items.Save();
            }

            return(errors);
        }