public TogglTask AddTask(string name, string owner, string uApiToken, string ApiToken,
     IEnumerable<TogglUser> users, IEnumerable<TogglProjectUser> projectUsers)
 {
     TogglTask task = default(TogglTask);
     // create a new task
     TogglProjectUser projectUser = default(TogglProjectUser);
     TogglUser user = users.Where(x => x.Email.Equals(owner, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault();
     if (user != null)
         projectUser = projectUsers.Where(x => x.UserId == user.Id).FirstOrDefault();
     if (projectUser == null) uApiToken = ApiToken;
     TogglTaskObj taskObj = new TogglTaskObj()
     {
         Task = new TogglTask()
         {
             Name = name,
             ProjectId = this.Id.Value,
             Active = true
         }
     };
     task = taskObj.Task;
     try
     {
         TogglDataObj result = TogglSession.PostDetails<TogglTaskObj>(uApiToken, taskObj, RequestUrl: TogglTaskUrl);
         task.Id = (int)result.Data.ExtensionDataMembers["id"];
     }
     catch (Exception)
     {
         task = null;
     }
     return task;
 }
 public TogglTask UpdateTask(TogglTask task, string owner, string uApiToken, string ApiToken,
     IEnumerable<TogglUser> users, IEnumerable<TogglProjectUser> projectUsers)
 {
     TogglProjectUser projectUser = default(TogglProjectUser);
     TogglUser user = users.Where(x => x.Email.Equals(owner, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault();
     if (user != null)
         projectUser = projectUsers.Where(x => x.UserId == user.Id).FirstOrDefault();
     if (projectUser == null) uApiToken = ApiToken;
     TogglTaskObj taskObj = new TogglTaskObj()
     {
         Task = task
     };
     try
     {
         TogglDataObj result = TogglSession.PutDetails<TogglTaskObj>(uApiToken, taskObj,
             RequestUrl: String.Format("{0}/{1}", TogglTaskUrl, task.Id));
     }
     catch (Exception)
     {
         task = null;
     }
     return task;
 }