/// <summary>
        /// Prepare data for SmartTile activity
        /// </summary>
        /// <returns></returns>
        public List<HolidayItem> LoadSmartTileFile()
        {
            DateTime refreshmentDate, endDate;
            int firstElement, lastElement, daysAmount;
            List<HolidayItem> events = new List<HolidayItem>();

            //--------------
            //set variables
            var array = Document.Root.Attribute("refreshmentDate").Value.Split(DataManager.DateSeparator);
            refreshmentDate = new DateTime(int.Parse(array[0]), int.Parse(array[1]), int.Parse(array[2]));
            daysAmount = int.Parse(Document.Root.Attribute("daysAmount").Value);


            //load files
            events = DataManager.GetComposedData(refreshmentDate, 1);

            bool toLoad = (refreshmentDate.Day == DateTime.Now.Day && refreshmentDate.Month == DateTime.Now.Month && refreshmentDate.Year == DateTime.Now.Year)
                            ? false : true;

            //-------------------------
            //set collection, if it isn't in file
            if (toLoad)
            {
                //set variables
                refreshmentDate = DateTime.Now;
                endDate = refreshmentDate.AddDays(daysAmount);
                firstElement = 0;

                Document.Root.Descendants().Remove();

                if (endDate.Month == refreshmentDate.Month)
                {
                    events = events.Where(x => x.Day >= refreshmentDate.Day && x.Day < endDate.Day).ToList();
                }
                else
                {
                    //from first month
                    events = events.Where(x => x.Day >= refreshmentDate.Day).ToList();

                    //from second month
                    var temp = DataManager.GetComposedData(endDate, 1);
                    events.AddRange(temp.Where(x => x.Day < endDate.Day).ToList());                    
                }

                //Sort
                events = events.OrderBy(x => x.Year).OrderBy(x => x.Month).OrderBy(x => x.Day).ToList();

                foreach (var ev in events)
                {
                    //complite file
                    using (XmlWriter writer = Document.Root.CreateWriter())
                    {
                        writer.WriteStartElement("event");

                        writer.WriteStartAttribute("value");
                        writer.WriteString(ev.HolidayName);
                        writer.WriteEndAttribute();
                        writer.WriteStartAttribute("day");
                        writer.WriteString(ev.Day.ToString());
                        writer.WriteEndAttribute();
                        writer.WriteStartAttribute("month");
                        writer.WriteString(ev.Month.ToString());
                        writer.WriteEndAttribute();
                        writer.WriteStartAttribute("year");
                        writer.WriteString(ev.Year.ToString());

                        writer.WriteEndAttribute();
                    }
                }
            }
            //or read collection from file
            else
            {
                //set variables
                firstElement = int.Parse(Document.Root.Attribute("firstElement").Value);
                endDate = refreshmentDate.AddDays(daysAmount);

                //read events from file
                foreach (var element in Document.Root.Elements())
                {
                    var listItem = new HolidayItem()
                    {
                        HolidayName = element.Attribute("value").Value,
                        Day = int.Parse(element.Attribute("day").Value),
                        Month = int.Parse(element.Attribute("month").Value),
                        Year = int.Parse(element.Attribute("year").Value)
                    };

                    events.Add(listItem);
                }

            }

            lastElement = firstElement + 4;


            if (events.Count > 5 && lastElement >= events.Count)
            {
                int difference = lastElement - firstElement;
                int toSkip = firstElement - difference;
                var subcoll = events.Skip(firstElement - 1).ToList();
                events = events.Take(difference).ToList();
                events.AddRange(subcoll);

                firstElement = difference;
            }
            else if (lastElement < events.Count)
            {
                events = events.Skip(firstElement).Take(5).ToList();

                firstElement = lastElement;
            }
            else firstElement = 0;


            //set attributes
            Document.Root.Attribute("firstElement").SetValue(firstElement.ToString());
            Document.Root.Attribute("refreshmentDate").SetValue(refreshmentDate.Date.ToString(DataManager.DateFormat));
            SaveDocument();

            return events;
        }
        /// <summary>
        /// Gets records from service
        /// </summary>
        /// <returns>requires async/await</returns>
        public async override Task GetHolidayList()
        {
#if WINDOWS_PHONE_APP
            credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
                      new Uri("ms-appx:///SocialNetworkConnector/client_wp.json"),
                      Scopes,
                      "user",
                      CancellationToken.None);
#else
            credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
                       new Uri("ms-appx:///SocialNetworkConnector/client_secret.json"),
                       Scopes,
                       "user",
                       CancellationToken.None);
#endif

            // Create Google Calendar API service.
            var service = new CalendarService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName = "Calendar and Holidays",
            });

            // Define parameters of request.
            EventsResource.ListRequest request = service.Events.List("primary");
            //set user max and min dates
            request.TimeMin = DateStart.Date;
            request.TimeMax = DateEnd.Date;
            //set details
            request.ShowDeleted = false;
            request.SingleEvents = true;
            request.MaxResults = 100;
            request.OrderBy = EventsResource.ListRequest.OrderByEnum.StartTime;

            // List events.
            Events events = request.Execute();
            if (events.Items != null && events.Items.Count > 0)
            {
                foreach (var eventItem in events.Items)
                {
                    string when = null;
                    try
                    {
                        when = eventItem.Start.DateTime.Value.Date.ToString(LocalDataManager.DateFormat);
                    }
                    catch
                    {
                        if (String.IsNullOrEmpty(when))
                            when = eventItem.Start.Date;                        
                    }

                    var array = when.Split(LocalDataManager.DateSeparator);
                    HolidayItem item = new HolidayItem
                    {
                        HolidayName = eventItem.Summary,
                        Day = Convert.ToInt32(array[2]),
                        Month = Convert.ToInt32(array[1]),
                        Year = Convert.ToInt32(array[0]),
                        HolidayTag = "M"
                    };

                    Items.Add(item);
                }
            }
            else Items = null;            
            Message();
        }