public IHttpActionResult PostCategories(int tournamentId, [FromBody] ICollection <Category> categories) { var result = new List <Category>(); if (ModelState.IsValid) { foreach (Category category in categories) { result.Add(tournamentRepository.AddCategory(tournamentId, category)); } } return(Json(result)); }