title: Meteor: insert produces multiple entries
body: <p>My Question is the following. </p>
  
  <p>I'm starting working with meteor and wrote some small code against meerkat. </p>
  
  <p>I'd like to insert the users into my database. I first have to call meerkat with the username for the meerkatId and then can get the user info. </p>
  
  <p>This is my code.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>Users = new Mongo.Collection("users");
  
  
  if (Meteor.isClient) {
  
  Template.body.helpers({
    users: function () {
        // Otherwise, return all of the tasks
        return Users.find({});
    }
  
  });
  
  Template.user.helpers({
    parentUsername: function (parentContext) {
  
        return parentContext.info.username;
    }
    
  });
  
    
  Template.body.events({
    "submit .user-search": function (event) {
      // This function is called when the new task form is submitted
      event.preventDefault();
      Meteor.call("removeAllUsers");
      Meteor.call("searchUser",  $("#username").val() );
  
  
      //event.target.text.value = "";
      // Prevent default form submit
      return false;
    }
  
  });
  
  
  
  Template.user.events({
    "click .getUserBroadcast": function () {
      // Set the checked property to the opposite of its current value
      Meteor.call("getUserBroadcasts",  this._id, this.meerkatId );
    }
  });
  
     
  }
  
  if (Meteor.isServer) {
    Meteor.startup(function () {
      // code to run on server at startup
      Users.remove({});
    });
  }
  
  
  Meteor.methods({
      searchUser: function (username) {
      HTTP.call("PUT", "https://social.meerkatapp.co/users/search?v=2",
            {data: {"username": username}},
            function (error, result) {
              if (!error) {
                 content=JSON.parse(result.content);
                 Meteor.call("getUserInfos", content.result[0]);
              }
            });
  
    },
  
    getUserInfos: function(meerkatId){
         HTTP.call("GET", "https://resources.meerkatapp.co/users/"+meerkatId+"/profile?v=1.0",
            {},
            function (error, result) {
              if (!error) {
                 contentJson=JSON.parse(result.content);
                 console.log(contentJson.result);
              
                 Users.insert(contentJson.result);
              }
            }); 
    },   
    removeAllUsers: function() {
          return Users.remove({});
    }
  });</code></pre>
  </div>
  </div>
  </p>
  
  <p>Can someone tell me why this resolves in 3 identical User Entries (_id not of course) while getting the console output just once ? </p>
  
  <p>When I do an insert in the searchUser method I get 2 Entries. I believe it's because of the asynchron callbacks. </p>
  
  <p>What am I doing wrong?</p>