public void AddStamps(Dictionary <string, byte[]> imgs, int imgTypeId) { var m = orMapper.ExecuteCommandScalar("select max(id) from Image"); int maxid = (int)m; foreach (var img in imgs) { try { maxid++; string name = Path.GetFileNameWithoutExtension(img.Key); string ext = Path.GetExtension(img.Key); Image image = new Image { Id = maxid, Name = name, Ext = ext, TheImage = img.Value, ImageGroup = "", ImageType_Id = imgTypeId }; orMapper.Insert <Image>(image); Images.Add(new ImageViewModel { Id = image.Id, Title = image.Name, ImageGroup = image.ImageGroup, TheImage = image.TheImage }); } catch { } } }