public async Task <IActionResult> RemoveHistoryItemFromDay([FromBody] DayHistoryItemForm data)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest());
                }

                var day = await _context.TrainingDays.SingleOrDefaultAsync(d => d.Id == data.DayId);

                if (day == null)
                {
                    return(NotFound(data.DayId));
                }

                var item = await _context.HistoryItems.SingleOrDefaultAsync(i => i.Id == data.Item.Id);

                if (item == null)
                {
                    return(NotFound(data.Item));
                }
                day.History.Remove(item);
                await _context.SaveChangesAsync();

                return(Ok(day));
            }
            catch (Exception e)
            {
                return(StatusCode(500));
            }
        }
        public async Task <IActionResult> AddHistoryItemToDay([FromBody] DayHistoryItemForm data)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest());
                }

                var day = await _context.TrainingDays.SingleOrDefaultAsync(d => d.Id == data.DayId);

                if (day == null)
                {
                    return(NotFound(data.DayId));
                }

                var item = await _context.HistoryItems.SingleOrDefaultAsync(i => i.Id == data.Item.Id);

                if (item == null)
                {
                    if (data.Item.Id != 0)
                    {
                        return(NotFound(data.Item));
                    }
                    data.Item.Workout = await _context.Workouts.SingleOrDefaultAsync(w => w.Id == data.Item.Workout.Id);

                    var result = await _context.HistoryItems.AddAsync(data.Item);

                    item = result.Entity;
                }
                day.History.Add(item);
                await _context.SaveChangesAsync();

                return(Ok(day));
            }
            catch (Exception e)
            {
                return(StatusCode(500));
            }
        }