public IEnumerable <Label> SaveLabels(Topic topic, ImageLabel image, IEnumerable <Label> labels) { #region validation if (topic == null) { throw new ArgumentNullException(nameof(topic)); } if (image == null) { throw new ArgumentNullException(nameof(image)); } #endregion List <Label> result = new List <Label>(); if (labels != null) { if (labels.Any()) { result = LabelRepository.AddOrUpdateOrDeleteLabels(topic, image, labels).ToList(); } else { LabelRepository.DeleteLabels(topic, image); } } return(result); }