public async Task <data.Task> Add(data.ToDoDbContext db, TaskAdd add)
        {
            try
            {
                var newTask = new data.Task();
                newTask.CompletedDate = add.CompletedDate;
                newTask.DueDate       = add.DueDate;
                newTask.Name          = add.Name;
                newTask.StartedDate   = add.StartedDate;
                newTask.Status        = add.Status;

                // Add references to parent Classes
                var userLookup = await db.Users.FirstOrDefaultAsync(w => w.UserId == add.UserUserId);

                if (userLookup != null)
                {
                    newTask.User = userLookup;
                }


                db.Tasks.Add(newTask);

                return(newTask);
            }

            catch (Exception e)
            {
                LogFactory.GetLogger().Log(LogLevel.Error, e);
                return(null);
            }
        }
        public async Task <data.Task> Add(TaskAdd add)
        {
            try
            {
                var newTask = new data.Task();
                newTask.CompletedDate = add.CompletedDate;
                newTask.DueDate       = add.DueDate;
                newTask.Name          = add.Name;
                newTask.StartedDate   = add.StartedDate;
                newTask.Status        = add.Status;

                newTask.TaskId = await data.Sequence.SequenceGenerator.GetNextId("Task");

                newTask.RowKey       = newTask.TaskId.ToString();
                newTask.UserUserId   = add.UserUserId;
                newTask.PartitionKey = add.UserUserId.ToString();
                TableOperation insertOperation = TableOperation.Insert(newTask);
                var            taskTable       = await data.Utils.GetTable("Task");

                await taskTable.ExecuteAsync(insertOperation);

                return(newTask);
            }

            catch (Exception e)
            {
                LogFactory.GetLogger().Log(LogLevel.Error, e);
                return(null);
            }
        }