public IActionResult Put(Guid guid, [FromBody] ViewModels.Api.Competition value)
        {
            var current = database.Competitions
                          .Include(x => x.Constraints)
                          .Include(x => x.Categories)
                          .Include(x => x.Jury)
                          .Include(x => x.Prizes)
                          .Where(x => x.Guid == guid)
                          .Single();

            value.Guid = guid;
            var competition = Competition.FromApiViewModel(value);

            database.Entry <Competition>(current).CurrentValues.SetValues(competition);

            current.Categories.Clear();
            current.Constraints.Clear();
            current.Jury.Clear();
            current.Prizes.Clear();

            current.Categories.AddRange(competition.Categories);
            current.Constraints.AddRange(competition.Constraints);
            current.Jury.AddRange(competition.Jury);
            current.Prizes.AddRange(competition.Prizes);

            database.SaveChanges();
            return(Ok());
        }
        public IActionResult Post([FromBody] ViewModels.Api.Competition value)
        {
            var competition = Competition.FromApiViewModel(value);

            competition.Guid            = Guid.NewGuid();
            competition.CreatorUserGuid = HttpContext.Session.Get <User>("user").Guid;
            database.Competitions.Add(competition);
            database.SaveChanges();
            return(Ok());
        }