public IDelta<ITask> AddTask(ITask task)
        {

            TaskObject taskPtr;

            IDelta<ITask> result = new Delta<ITask>(taskPtr = new TaskObject(task));


            if (string.IsNullOrWhiteSpace(task.Objective))
            {
                result.ApplyThrowError(x => x.Objective);
            }

            if (string.IsNullOrWhiteSpace(task.Name))
            {
                result.ApplyThrowError(x => x.Name);
            }

            if (task.StartDateTime > task.EndDateTime || task.StartDateTime ==DateTime.MinValue || task.EndDateTime == DateTime.MinValue)
            {
                result.ApplyThrowError(x => x.StartDateTime)
                      .ApplyThrowError(x => x.EndDateTime  );
            }


            if (result.HasErrors)
            {
                return result.AsNewTask();
            }



            taskPtr.Id = Guid.NewGuid();

            taskPtr.CreatedDateTime = DateTime.Now;
            taskPtr.Author          = new UserObject(userContext.Logged);

            taskPtr.Status = new TaskStatus(clsService.GetStatus(StatusCode.Pending));


            if (task.ToEmployee == null)
            {
                taskPtr.ToEmployee = taskPtr.Author;
            }

            if (task.Manager==null)
            {
                taskPtr.Manager = taskPtr.Author;
            }



            result
                .AcceptUpdate(x=>x.Id)
                .AcceptUpdate(x=>x.Status)
                .AcceptUpdate(x=>x.Priority)
                .AcceptUpdate(x => x.Name)
                .AcceptUpdate(x=>x.Objective)
                .AcceptUpdate(x=>x.Author)
                .AcceptUpdate(x=>x.Manager)
                .AcceptUpdate(x=>x.ToEmployee)
                .AcceptUpdate(x=>x.CreatedDateTime)
                .AcceptUpdate(x=>x.StartDateTime)
                .AcceptUpdate(x => x.EndDateTime);

            return repositoryContext
                   .InsertTask(result)
                   .ToDelta   ();
        }