public int Load(IEnumerable <PsmartSource> sources, bool clearFirst = true) { if (clearFirst) { _psmartStageRepository.Clear(_emr); } var stages = _mapper.Map <IEnumerable <PsmartSource>, IEnumerable <PsmartStage> >(sources); _psmartStageRepository.Load(stages); _psmartStageRepository.SaveChanges(); return(_psmartStageRepository.Count(_emr)); }