public async Task<int> Save(long routeId, long stationId, int number)
        {
            if(routeId <= 0) throw new ArgumentException("routedId <= 0");
            if(stationId <= 0) throw new ArgumentException("stationId <= 0");

            using (var db = new Db())
            {
                using (var transtaction = db.Database.BeginTransaction(IsolationLevel.RepeatableRead))
                {
                    try
                    {
                        var route = db.Routes.SingleOrDefault(r => r.Id == routeId);
                        if (route == null) throw new NullReferenceException("route");

                        var station = db.Stations.SingleOrDefault(r => r.Id == stationId);
                        if (station == null) throw new NullReferenceException("station");

                        var routeStation = new RouteStation() { Number = number, RouteId = routeId, StationId = stationId };
                        db.Entry(routeStation).State = EntityState.Added;
                        return await db.SaveChangesAsync();
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex.Message);
                        transtaction.Rollback();
                        throw;
                    }
                }
            }

        }
        public async Task Update(Color t)
        {
            
            if (t == null)
                throw new NullReferenceException("color");

            using (var db = new Db())
            {
                db.Entry(t).State = EntityState.Modified;
                await db.SaveChangesAsync();
            }
        }
        public async Task Save(Color t)
        {
            if(t == null)
                throw new NullReferenceException("color");

            using (var db = new Db())
            {
                try
                {
                    db.Entry(t).State = EntityState.Added;
                    await db.SaveChangesAsync();
                }
                catch (Exception exception)
                {
                    Log.Error(exception.Message);
                    throw;
                }
            }
        }
        public async Task<int> Delete(long routeId, Station station)
        {
            if(routeId <= 0) throw new ArgumentException("routeId <= 0");
            if(station == null) throw new ArgumentNullException("station");

            using (var db = new Db())
            {
                try
                {
                    if (station.Id <= 0)
                    {
                        station = await _stationRepository.GetByLatLng(station.Latitude, station.Longitude);
                        if(station == null)throw new NullReferenceException("station");
                    }

                    var routeStation = new RouteStation() {RouteId = routeId, StationId = station.Id};
                    db.Entry(routeStation).State = EntityState.Deleted;
                    return await db.SaveChangesAsync();
                }
                catch (Exception ex)
                {
                    Log.Error(ex.Message);
                    throw;
                }
            }

        }
        public async Task<int> Delete(long routeId, long stationId)
        {
            if(routeId <= 0) throw new ArgumentException("routeId <= 0");
            if(stationId <= 0) throw new ArgumentException("stationId <= 0");

            using (var db = new Db())
            {
                try
                {
                    var routeStation = new RouteStation() {RouteId = routeId, StationId = stationId};
                    db.Entry(routeStation).State = EntityState.Deleted;
                    return await db.SaveChangesAsync();
                }
                catch (Exception ex)
                {
                    Log.Error(ex.Message);
                    throw;
                }
            }

        }