public IDelta<ITask> UpdateTask(ITask task)
        {
            IDelta<ITask> taskResult = task.ToDelta();

            if (userContext.IsEqualOr(task.Author, task.Manager))
            {
                taskResult.AcceptUpdate(x => x.Priority)
                          .AcceptUpdate(x => x.Description);
            }

            if (userContext.IsEqual(task.Author) && task.Status.Code == StatusCode.Pending)
            {
                taskResult
                     .AcceptUpdate(x => x.Name)
                     .AcceptUpdate(x => x.Objective)
                     .AcceptUpdate(x => x.StartDateTime)
                     .AcceptUpdate(x => x.EndDateTime);
            }

            if (userContext.IsEqual(task.ToEmployee) && task.Status.Code == StatusCode.InProcess)
            {
                taskResult.AcceptUpdate(x => x.Result);
            }

            return repositoryContext.UpdateTask(taskResult).ToDelta();
          }
        public IDelta<ITask> RemoveTask(ITask task)
        {

            if (userContext.IsEqual(task.Author))
            {
                repositoryContext.RemoveTask(task.Id);
            }


            return task.ToDelta();

        }
        public IDelta<ITask> RevertToRevision(ITask task)
        {

            if (userContext.IsEqualOr(task.Manager, task.Author) && task.Status.Code == StatusCode.Done)
            {
                return repositoryContext.UpdateTask(task.ChangeStatus(StatusCode.Revision)).ToDelta();
            }

            return task.ToDelta();
        }
        public IDelta<ITask> RejectTask(ITask task)
        {

            if (userContext.IsEqual(task.Author))
            {
                return repositoryContext.UpdateTask(task.ChangeStatus(StatusCode.Refused)).ToDelta();
            }

            return task.ToDelta();
        }
        public IDelta<ITask> AcceptTask(ITask task)
        {
            if (userContext.IsEqual(task.Manager) && task.Status.Code == StatusCode.Done)
            {
                return repositoryContext.UpdateTask(task.ChangeStatus(StatusCode.Accepted)).ToDelta();
            }

            return task.ToDelta();
        }
        public IDelta<ITask> EndingTask(ITask task)
        {

            if (userContext.IsEqual(task.ToEmployee) && task.Status.Code == StatusCode.InProcess)
            {
                return repositoryContext.UpdateTask(task.ChangeStatus(StatusCode.Done)).ToDelta();
            }

            return task.ToDelta();
        }