public async Task AddSlotRange(SlotsCreateContract slotContract, CancellationToken cancellationToken)
        {
            var slot = SlotsMapping.SlotMapFromContractToModel(slotContract);

            if (slot.StartTime > slot.Duration)
            {
                _logger.LogInformation($"Slot with id {slot.Id} has duration more than start time");
                throw new ArgumentException();
            }

            var timeEnd = slot.Duration;


            if (_dbContext.Slots.Where(x => x.Date == slot.Date)
                .Where(x => x.StartTime <= slot.Duration).Where(x => x.CoachId == slot.CoachId).Any(x => x.StartTime >= slot.StartTime))
            {
                _logger.LogInformation($"Slots are already created in time range" +
                                       $" {slot.Date.Add(slot.StartTime)} - {slot.Date.Add(slot.Duration)}," +
                                       $" for coach with id {slot.CoachId}");

                throw new ArgumentException("Some slots created in this time range, for this coach");
            }

            var slots = new List <Slot>();

            while (slot.StartTime <= timeEnd)
            {
                var resultSlot = new Slot
                {
                    CoachId   = slot.CoachId,
                    Duration  = TimeSpan.FromHours(1),
                    Date      = slot.Date,
                    StartTime = slot.StartTime,
                };
                slots.Add(resultSlot);
                slot.StartTime += resultSlot.Duration;
            }

            try
            {
                await _dbContext.AddRangeAsync(slots, cancellationToken);

                await _dbContext.SaveChangesAsync(cancellationToken);
            }
            catch
            {
                _logger.LogInformation($"Slots are not added in time range" +
                                       $" {slot.Date.Add(slot.StartTime)} - {slot.Date.Add(slot.Duration)}," +
                                       $" for coach with id {slot.CoachId}");
                throw new ArgumentException();
            }
        }
 /// <summary>
 /// from contract to model
 /// </summary>
 /// <param name="contract"></param>
 /// <returns></returns>
 public static Slot SlotMapFromContractToModel(SlotsCreateContract contract)
 {
     if (contract == null)
     {
         return(null);
     }
     return(new Slot
     {
         Id = contract.Id,
         CoachId = contract.CoachId,
         Date = DateTime.ParseExact(contract.DateStart, Settings.DateFormat, null, DateTimeStyles.None),
         Duration = TimeSpan.Parse(contract.TimeEnd, null),
         StartTime = TimeSpan.Parse(contract.TimeStart, null)
     });
 }