public int ReserveSession(DateTime dateTime, TimeSpan timeOfBegin, int doctorId, int userId)
        {
            if (!IsInDoctorWorkDay(doctorId, dateTime, timeOfBegin))
            {
                throw new Exceptions.WarningException(ExceptionMessages.SessionOutSideTiming);
            }

            lock (_locker.GetOrAdd(doctorId))
            {
                if (!IsTimeSlotFree(doctorId, dateTime, timeOfBegin))
                {
                    throw new Exceptions.WarningException(ExceptionMessages.SessionWasReserved);
                }

                var timeOfEnd = timeOfBegin.Add(TimeSpan.FromMinutes(30));

                return(_sessionRepository.AddNewSession(new Session
                {
                    Date = dateTime,
                    DoctorId = doctorId,
                    UserId = userId,
                    TimeOfBeginSession = timeOfBegin,
                    TimeOfEndSession = timeOfEnd
                }));
            }
        }