I'm trying to insert location information to SQLite db using CoreData framework. I have copied partial code below.

This is working nicely and I see that I can insert latitude & longitude information without any issues. Only thing is that it's inserting too many rows with same latitude longitude couple.

I think I'm missing a basic logic, but I can't see it right now.

```
- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    locationManager = [[CLLocationManager alloc] init];
}

- (IBAction)BtnGetMyLocationPressed:(UIButton *)sender {

    locationManager.delegate=self;
    locationManager.desiredAccuracy=kCLLocationAccuracyBest;
    locationManager.distanceFilter=kCLDistanceFilterNone;
    [locationManager startUpdatingLocation];
}

- (void)locationManager:(CLLocationManager *)manager
    didUpdateToLocation:(CLLocation *)newLocation
           fromLocation:(CLLocation *)oldLocation
{
    // Delegate Method of CLLocation Manager
    CLLocation *currentLocation = newLocation;

    // Get the Device ID
    UIDevice *device = [UIDevice currentDevice];
    NSString  *currentDeviceId = [[device identifierForVendor]UUIDString];
    // Do something with the Device Information

    MBLAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
    NSManagedObjectContext *context =[appDelegate managedObjectContext];

    Locations *newLocationRecord= [NSEntityDescription
                  insertNewObjectForEntityForName:@"Locations"
                  inManagedObjectContext:context];
    newLocationRecord.deviceID = currentDeviceId;
    newLocationRecord.dateUpdate = [NSDate date];
    newLocationRecord.latitudeLoc = [NSNumber numberWithFloat:(currentLocation.coordinate.latitude)];
    newLocationRecord.longitudeLoc = [NSNumber numberWithFloat:(currentLocation.coordinate.longitude)];

    NSError *error;
    [context save:&error];

}

```