/// <summary>
        /// Get all information about a cohort
        /// </summary>
        /// <param name="cs"></param>
        /// <param name="cohort"></param>
        /// <returns></returns>
        public static async Task<CohortDisplayObject> GetCohortDisplayObject(CohortService cs, Cohort cohort)
        {
            //check to see if the item is already in cache. if so, return the cache item
            var cache = (CohortDisplayObject)HttpContext.Current.Cache[cohort.id];
            if (cache != null)
                return cache;

            var students = GetStudentsByCohortId(cs, cohort.id);
            var custom = GetCohortCustomByCohortId(cs, cohort.id);

            await Task.WhenAll(students, custom);

            var displayObject = new CohortDisplayObject();
            displayObject.cohort = cohort;
            displayObject.students = from s in students.Result select s.id;
            displayObject.custom = JsonConvert.DeserializeObject<CohortCustom>(custom.Result); ;

            HttpContext.Current.Cache.Insert(cohort.id, displayObject);
            return displayObject;
        }
        /// <summary>
        /// Update a single cohort
        /// </summary>
        /// <returns>result of the update</returns>
        public async Task<Result> UpdateCohort(CohortService cs, Cohort cohort)
        {
            try
            {
                var userSession = (UserSession)Session[INBLOOM_USER_SESSION];

                //user session has edOrgId == null but we need edOrgId to update a cohort
                if (userSession != null && userSession.edOrgId != null && userSession.edOrgId != "")
                    cohort.educationOrgId = userSession.edOrgId;
                else
                    cohort.educationOrgId = CURRENT_ED_ORG_ID;

                var response = await cs.Update(cohort);

                var result = new Result
                {
                    completedSuccessfully = response.StatusCode == HttpStatusCode.NoContent,
                    objectActionResult = GlobalHelper.GetActionResponseResult(cohort.id, cohort.cohortIdentifier, response, HttpStatusCode.NoContent)
                };

                return result;
            }
            catch (Exception e)
            {
                throw;
            }
        }
        /// <summary>
        /// Create a single cohort
        /// </summary>
        /// <returns>result of the cohort creation</returns>
        public async Task<Result> CreateCohort(CohortService cs, Cohort cohort) //TODO: modify to accept a cohort argument
        {
            try
            {
                var userSession = (UserSession)Session[INBLOOM_USER_SESSION];

                //set temporary edorgid because it's null from the INBLOOM API
                if (userSession != null && userSession.edOrgId != null && userSession.edOrgId != "")
                    cohort.educationOrgId = userSession.edOrgId;
                else
                    cohort.educationOrgId = CURRENT_ED_ORG_ID;
                cohort.cohortType = InBloomClient.Enum.CohortType.Other;

                var response = await cs.Create(cohort);

                var result = new Result
                {
                    completedSuccessfully = response.StatusCode == HttpStatusCode.Created,
                    objectActionResult = GlobalHelper.GetActionResponseResult("", cohort.cohortIdentifier, response, HttpStatusCode.Created)
                };

                if (response.StatusCode == HttpStatusCode.Created)
                {
                    //another way of getting the Id: result.Headers.Location.AbsolutePath.Substring(result.Headers.Location.AbsolutePath.LastIndexOf("/") + 1)              
                    result.objectActionResult.objectId = response.Headers.Location.Segments[5]; //getting the id from header location
                    result.objectActionResult.objectName = cohort.cohortIdentifier;
                }

                return result;
            }
            catch
            {
                throw;
            }
        }