//Speichert die Filme in die Datenbank
        public async void SaveData(List <OmbiMovieListModel> ombiMovieListModels)
        {
            // prüfen ob der Film bereits in der DB ist..... Speichern des Movies
            foreach (OmbiMovieListModel m in ombiMovieListModels.Where(n => n.available == false))
            {
                CustomMovie _customMovie = _db.CustomMovie.Where(a => a.MovieDbId == m.theMovieDbId).FirstOrDefault();
                if (_customMovie == null)
                {
                    ApiQueryResponse <Movie> findMovie = await searchMoviefromTheMovieDB(m.theMovieDbId);

                    _db.Add(new CustomMovie {
                        OriginalTitle = findMovie.Item.OriginalTitle, PosterPath = "http://image.tmdb.org/t/p/w185/" + findMovie.Item.PosterPath, Overview = findMovie.Item.Overview, Rating = findMovie.Item.VoteAverage, MovieDbId = findMovie.Item.Id, Releasenames = GetText(findMovie.Item.Title), Title = findMovie.Item.Title
                    });
                    _db.SaveChanges();
                }
            }
            // Filme die bereits vorhanden sind aus DB löschen
            foreach (OmbiMovieListModel m in ombiMovieListModels.Where(n => n.available == true))
            {
                CustomMovie _customMovie = _db.CustomMovie.Where(a => a.MovieDbId == m.theMovieDbId).FirstOrDefault();
                if (_customMovie != null)
                {
                    //Nach den Releasenamensuchen und wenn vorhanden auch löschen
                    Releasenames[] _releasenames = _db.Releasenames.Where(r => r.MovieId == _customMovie.Id).ToArray();
                    if (_releasenames != null)
                    {
                        _db.Releasenames.RemoveRange(_releasenames);
                    }

                    _db.CustomMovie.Remove(_customMovie);
                    _db.SaveChanges();
                }
            }
        }
        public void GetFtpReleases()
        {
            //Konfig FTP Folder parsen
            //var ftpConfig = FtpConfiguration.Value;
            string[] sArray = FtpConfiguration.Value.Folders.Split(';');


            log.Info("Task: Lade FTP Konfig");
            Rebex.Licensing.Key = "==AOptXWwcjeC/mE+S0K60UcnUhOW7heBDBmgjFhBdpuvU==";
            try
            {
                using (var client = new Rebex.Net.Ftp())
                {
                    client.Settings.SslAcceptAllCertificates = true;
                    // connect and log in
                    client.Connect(FtpConfiguration.Value.Host, FtpConfiguration.Value.Port);
                    //if ssl true
                    if (FtpConfiguration.Value.Ssl == true)
                    {
                        client.Secure();
                    }
                    //FTP Login
                    log.Info("Task: FTP Login");
                    client.Login(FtpConfiguration.Value.Username, FtpConfiguration.Value.Passwort);
                    //FTP Root Login
                    client.ChangeDirectory("/");

                    //FTP Ordner durchsuchen
                    log.Info("Task: FTP Ordner durchsuchen");
                    foreach (string s in sArray)
                    {
                        string[] dataItems = client.GetNameList(s);

                        foreach (string a in dataItems)
                        {
                            string relname  = a.Substring(a.LastIndexOf("/") + 1);
                            string relgroup = a.Substring(a.LastIndexOf("-") + 1);

                            FtpRelease _ftpRelease = _db.FtpRelease.Where(r => r.FtpReleasename == relname).FirstOrDefault();

                            if (_ftpRelease == null)
                            {
                                _db.Add(new FtpRelease {
                                    FtpReleasename = relname, FtpReleaseGroup = relgroup, FtpFolder = a
                                });
                                _db.SaveChanges();
                            }
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                log.Info("Task: Fehler" + ex);
            }
        }