public Level EditLevel(LevelBindingModel model)
        {
            var level = _unitOfWork.LevelsRepository.Data.FirstOrDefault(d => d.Id == model.Id);

            if (level == null)
            {
                return(null);
            }

            level.Name = model.Name;
            level.MinEntryTaskScore = model.MinEntryTaskScore;

            var result = _unitOfWork.LevelsRepository.Update(level);

            return(result);
        }
        public async Task <Level> AddLevel(LevelBindingModel model)
        {
            var exist = _unitOfWork.LevelsRepository.Data.Any(d => d.Name.ToLower() == model.Name.ToLower());

            if (exist)
            {
                return(null);
            }

            var level = new Level()
            {
                MinEntryTaskScore = model.MinEntryTaskScore,
                Name = model.Name
            };

            var result = await _unitOfWork.LevelsRepository.AddAsync(level);

            return(result);
        }