public IHttpActionResult AddTaskToProject(int projectId, ProjectTask projectTask)
        {
            var user = db.Users.FirstOrDefault(u => u.UserName == User.Identity.Name);
            var project = user.projects.FirstOrDefault(p => p.ProjectId == projectId);
            if (user == null || project == null)
            {
                return BadRequest();
            }
            user.tasks.Add(projectTask);
            project.tasks.Add(projectTask);

            db.SaveChanges();
            return Ok(projectTask);
        }
        public IHttpActionResult PostProjectTask(ProjectTask projectTask)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.ProjectTasks.Add(projectTask);
            db.SaveChanges();

            return CreatedAtRoute("DefaultApi", new { id = projectTask.ProjectTaskId }, projectTask);
        }
        public IHttpActionResult PutProjectTask(int id, ProjectTask projectTask)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != projectTask.ProjectTaskId)
            {
                return BadRequest();
            }

            db.Entry(projectTask).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProjectTaskExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }