private IActionResult ScheduleTimeSlot(TimeSlotModel model)
        {
            if (model == null)
            {
                return(BadRequest("There is no enough information to schedule time slot"));
            }


            var timeSlot = model.ToEntity();

            try
            {
                //prevent overlapping of time slots which can due to overlapping of requests
                lock (Locker)
                {
                    var minimalStartDate = (timeSlot.ScheduledFor ?? DateTime.Now).AddHours(-8);
                    Expression <Func <SchedulingBoard, bool> > condition;
                    if (timeSlot.ScheduledFor.HasValue)
                    {
                        condition = m =>
                                    m.StartsAt.CompareTo(minimalStartDate) > 0 && m.StartsAt.CompareTo(timeSlot.ScheduledFor.Value) <= 0;
                    }
                    else
                    {
                        condition = m =>
                                    m.StartsAt.CompareTo(minimalStartDate) > 0;
                    }

                    var schedulingBoardCandidates = _schedulingRepository.FetchBoardsAsync(condition).Result;
                    foreach (var schedulingBoardCandidate in schedulingBoardCandidates)
                    {
                        if (!timeSlot.ScheduledFor.HasValue)
                        {
                            var scheduledFor = schedulingBoardCandidate.GetTimeForTimeSlot(timeSlot);
                            if (scheduledFor.HasValue)
                            {
                                timeSlot.SetTime(scheduledFor);
                            }
                            else
                            {
                                continue;
                            }
                        }
                        else if (!schedulingBoardCandidate.IsTimeSlogValidForBoard(timeSlot))
                        {
                            continue;
                        }

                        timeSlot.SchedulingBoardId = schedulingBoardCandidate.Id;
                        _schedulingRepository.Schedule(timeSlot).Wait();
                        return(Ok(timeSlot));
                    }
                }
            }
            catch (ArgumentException ae)
            {
                return(BadRequest(ae.Message));
            }
            return(BadRequest("Business rules prevented scheduling"));
        }
        public async Task <IActionResult> GetAllBoardsAsync()
        {
            var results = await _schedulingRepository.FetchBoardsAsync();

            return(Ok(results));
        }