public static void CloneProfile(Models.ImageProfile imageProfile)
{
var originalName = imageProfile.Name;
using (var uow = new DAL.UnitOfWork())
{
for (int c = 1; c <= 100; c++)
{
var newProfileName = imageProfile.Name + "_" + c;
if (uow.ImageProfileRepository.Exists(h => h.Name == newProfileName))
continue;
var clonedProfile = imageProfile;
clonedProfile.Name = newProfileName;
clonedProfile.Description = "Cloned From " + originalName;
AddProfile(clonedProfile);
break;
}
}
}