public async Task Save(IEnumerable <Recognition> recognitons)
        {
            await Task.Run(async() =>
            {
                using (var db = new DataBaseSetup.Context())
                {
                    foreach (var r in recognitons)
                    {
                        var rec = (from b in db.Recognitions
                                   where r.Title == b.Title
                                   select b).FirstOrDefault();

                        if (rec == null)
                        {
                            db.Recognitions.Add(new DataBaseSetup.Recognition
                            {
                                Title = r.Title,
                            });
                            await db.SaveChangesAsync();

                            rec = (from b in db.Recognitions
                                   where b.Title == r.Title
                                   select b).FirstOrDefault();
                        }

                        List <DataBaseSetup.Photo> a = new List <DataBaseSetup.Photo>();
                        foreach (var photo in r.Photos)
                        {
                            if (!photo.IsSavedInDataBase)
                            {
                                a.Add(new DataBaseSetup.Photo
                                {
                                    Path   = photo.Path,
                                    Pixels = new DataBaseSetup.Blob
                                    {
                                        Pixels = photo.Pixels
                                    },
                                    RecognitionId = rec.Id
                                });
                            }
                            photo.IsSavedInDataBase = true;
                        }
                        db.Photos.AddRange(a);
                    }
                    await db.SaveChangesAsync();
                }
            });
        }
 public async Task Clear()
 {
     await Task.Run(async() =>
     {
         using (var db = new DataBaseSetup.Context())
         {
             db.Recognitions.RemoveRange(db.Recognitions);
             db.Photos.RemoveRange(db.Photos);
             db.Blobs.RemoveRange(db.Blobs);
             await db.SaveChangesAsync();
         }
     });
 }