async public Task<ActionResult> UpdateLO(LearningObject obj, List<Tag> tags)
        {
            try
            {
                obj.updated_at = DateTime.UtcNow;
                await _mLearningService.UpdateObject<LearningObject>(obj);

                ///Update tag list
                if (tags != null)
                {
                    var curtags = await _mLearningService.GetLOTags(obj.id);
                    var curtagsids = curtags.Select(t => t.id);
                    var tagids = tags.Select(t => t.id);

                    var toDelete = curtagsids.Except(tagids).ToList();
                    var toAdd = tagids.Except(curtagsids).ToList();

                    foreach (int id in toDelete)
                    {
                        await _mLearningService.DeleteTagFromLO(id, obj.id);
                    }

                    foreach (int id in toAdd)
                    {
                        await _mLearningService.AddTagToLO(id, obj.id);
                    }
                }
                return Json(new JsonActionResult());
            }
            catch (Exception e)
            {
                return Json(new { errors = new String[] { e.Message } });
            }
        }
        async public Task<ActionResult> Upload(HttpPostedFileBase file, HttpPostedFileBase bg_file, LearningObject obj)
        {

            string cover_url = null;
            string bg_url = null;
            if (file != null && file.ContentLength > 0)
            {


                using (MemoryStream target = new MemoryStream())
                {

                    file.InputStream.CopyTo(target);

                    cover_url = await _mLearningService.UploadResource(target, null);
                }


            }

            if (bg_file != null && bg_file.ContentLength > 0)
            {


                using (MemoryStream target = new MemoryStream())
                {
                    bg_file.InputStream.CopyTo(target);

                    bg_url = await _mLearningService.UploadResource(target, null);
                }


            }


            obj.created_at = DateTime.UtcNow;
            obj.updated_at = DateTime.UtcNow;
            //obj.url_cover = cover_url;
            //obj.url_background = bg_url;

            obj.Publisher_id = PublisherID;


            int LO_id = await _mLearningService.CreateObject<LearningObject>(obj, lo => lo.id);

            return RedirectToAction("Index", new { id = UserID });
        }
        async public Task<ActionResult> CreateLO(LearningObject obj, List<Tag> tags)
        {

            if (PublisherID == default(int))
                return Json(new JsonActionResult { errors = new String[] { "No publisher defined" } });
            try
            {
                //Create LO

                obj.created_at = DateTime.UtcNow;
                obj.updated_at = DateTime.UtcNow;

                obj.Publisher_id = PublisherID;

                int LO_id = await _mLearningService.CreateObject<LearningObject>(obj, lo => lo.id);

                await _mLearningService.PublishLearningObjectToCircle(CircleID, LO_id);

                foreach (Tag t in tags)
                {
                    await _mLearningService.AddTagToLO(t.id, LO_id);
                }

                return Json(new JsonActionResult { url = Url.Action("LODetail", new { id = LO_id }) });
            }
            catch (Exception e)
            {
                return Json(new { errors = new Object[] { e } });
            }
        }