public void ExecuteTest()
        {
            var cmd = new GetFacebookEventsCommand()
            {
                Args = new CommandArgs.GetFacebookEventsCommandArgs()
                {
                    FacebookId = "lost577",
                    Limit = 3,
                    FacebookAccessToken = "CAAV4JtLrzl8BAOS6SrV89JV8bwJlaUxXQltYbzz2nRv7M8hn8meSgFynG6KKwzkB3YiW9p3hEXqVFCfDCGeZCby0D06qPo9kZAQSPyfHcGt8jGk5x18pjJdgyG1ZAbW1UYcRymuUcipCfg67gldJS1SFUyy92tfDAk1oDDcKgmgVpRhcHq7VPOZCNdl1cI8ZD"
                }
            };

            cmd.Execute();

            Assert.IsNotNull(cmd.Results);

            Assert.IsNotNull(cmd.Results.Items);

            var list = cmd.Results.Items.ToList();

            Assert.IsNotNull(list[0]);

            var fbEvent = list[0];

            Assert.IsFalse(fbEvent.EndTime == DateTimeOffset.MinValue);

            Assert.IsFalse(fbEvent.StartTime == DateTimeOffset.MinValue);

            Assert.IsNotNull(fbEvent.Picture);

            Assert.IsNotNull(fbEvent.Picture.Data.Url);
        }
        public void Execute()
        {
            var places = CacheHelper.Places;
            var toReturn = new List<FacebookEventPlace>();
            List<Task> tasks = new List<Task>();

            foreach (var place in places)
            {
                if (string.IsNullOrWhiteSpace(place.FacebookId))
                    continue;

                var task = new Task<FacebookEventPlace>(() =>
                {
                    var cmd = new GetFacebookEventsCommand()
                    {
                        Args = new GetFacebookEventsCommandArgs()
                        {
                            Limit = 3,
                            FacebookAccessToken = AccessTokenArgs,
                            FacebookId = place.FacebookId
                        }
                    };

                    try
                    {
                        Runner.RunCommand(ref cmd);
                        if (cmd.Results != null && cmd.Results.Items != null && cmd.Results.Items.Count > 0)
                        {
                            return new FacebookEventPlace(cmd.Results.Items.FirstOrDefault(), place.Id);
                        }
                        else
                            return null;

                    }
                    //TODO LOG HERE
                    catch (Exception ex)
                    {
                        return null;
                    }
                });

                tasks.Add(task);
                task.Start();
            }

            Task.WaitAll(tasks.ToArray());

            foreach (Task<FacebookEventPlace> task in tasks)
            {
                if(task.Result != null)
                    toReturn.Add(task.Result);
            }

            if(toReturn.Count > 0)
                Results = toReturn;
        }
        public FacebookEvent GetEvent(string accesstoken, string facebookId)
        {
            var cmd = new GetFacebookEventsCommand()
            {
                Args = new GetFacebookEventsCommandArgs()
                {
                    Limit = 3,
                    FacebookAccessToken = accesstoken,
                    FacebookId = facebookId
                }
            };

            Runner.RunCommand(ref cmd);

            if (cmd.Results != null && cmd.Results.Items != null)
                return cmd.Results.Items.FirstOrDefault();
            else
                return null;
        }