public ResultHandler <TrainerDto> Update(TrainerDto trainerDto) { ResultHandler <TrainerDto> resultHandler = new ResultHandler <TrainerDto>(); if (trainerDto.Id == Guid.Empty) { resultHandler.Errors.Add("Trainer id can't be empty"); return(resultHandler); } try { Trainer trainer = _trainerRepository.FindOne(trainerDto.Id); if (trainer == null) { resultHandler.Errors.Add("No such trainer exists"); return(resultHandler); } trainer = _trainer.Update(trainer, trainerDto.FirstName, trainerDto.LastName, trainerDto.Description, trainerDto.PayRate, trainerDto.IsActive); _trainerRepository.Update(trainer); resultHandler.Data = AutoMapper.Mapper.Map <Trainer, TrainerDto>(trainer); } catch (Exception ex) { resultHandler.Errors.Add(ex.Message); } return(resultHandler); }