public string Add(string tempFile, int fotoserieId, int id, string extension) { string filename = id.ToString() + extension; string permPath = Path.Combine(FileFotoRepository.RemoveBadPathChars(FotoserieDirectoryExists(fotoserieId)), FileFotoRepository.RemoveBadPathChars(filename)); string otherPath = ImageTypeExists(permPath); if (otherPath != string.Empty) { File.Delete(tempFile); return(otherPath); } File.Move(tempFile, permPath); return(permPath); }